<?php
/********************************************************
  nom           :   Common Functional Library 
  version       :   1.0.92
  autheur       :   pma
  date          :   14/02/2013
  description   :   Cette librairie comporte les fonctions générales et communes au module de gestion EAI
  Remarque(s)   :   
*************************************************************************/
include_once('EAI_template_interface.class.php');
include_once('gui_eai.inc.php');
include_once('lib/html2pdf/html2pdf.class.php');

class EAI implements EAI_template_interface{

	protected $id_user;
	protected $id_profile_type;
	protected $id_compte_client;
	protected $db_name;
	
	protected $years; 
	protected $last_year;
	protected $tab_node_user;		
	protected $tab_manager_under_user;		
	protected $listManager;
	protected $listNode;
	
	//============================================================================
	// __construct
	//============================================================================
	public function __construct($param_id_user,$param_id_compte_client,$param_db_name,$id_profile_type)
	{
		try
		{
			$this->id_user			=	$param_id_user;
			$this->id_profile_type	=	$id_profile_type;
			$this->id_compte_client	=	$param_id_compte_client;
			$this->db_name			=	$param_db_name;
			
			$this->listManager      =   NULL;
			$this->listNode         =   NULL;
			// On stocke les années pour lesquels nous avons des EAI
			$this->years = $this->get_years_eai();
			if($this->years != NULL && $this->years[0][0] != NULL) 
				$this->last_year = $this->years[0][0] ; 
		}
		catch (Exception $e)
		{
			throw new Exception($e->getMessage());
		}
	}
	public function get_id_user(){          return $this->id_user;}
	public function get_id_profile_type(){  return $this->id_profile_type;}
	public function get_id_compte_client(){ return $this->id_compte_client;}
	public function get_db_name(){          return $this->db_name;}
	
	public function set_tab_node_user($tab_node_user){  return $this->tab_node_user=$tab_node_user;}
	public function set_tab_manager_under_user($tab_manager_under_user){       return $this->tab_manager_under_user=$tab_manager_under_user;}
	
	//============================================================================
	// get_years_eai
	//============================================================================
	public function get_years_eai()
	{
		try
		{
			GLOBAL $REQUEST_167;
			$data = db_request_select($REQUEST_167 , NULL , $this->db_name);
			return $data ; 
		}
		catch (Exception $e)
		{
			throw new Exception($e->getMessage());
		}
	}
	//============================================================================
	// update_eai_status
	//============================================================================
	public function update_eai_status()
	{
		GLOBAL $REQUEST_142,$REQUEST_158,$REQUEST_159 ; 
		try
		{
			// recherche de la dernière campagne
			$data   =	db_request_select($REQUEST_142,NULL,$this->db_name);
			
			//Si une campagne est dans la base de données
			if($data != NULL && $data[0][0] !=NULL)
			{
				// Si la date de début est supérieure à la date du jout ET la date de fin de la campagne est inférieure 
				// à la date du jour alors on considère que c'est une campagne d'évaluation en cours de validité
				$aujourdhui = new DateTime("now");
				$date_debut = DateTime::createFromFormat("d/m/Y",$data[0][1]);
				$date_fin   = DateTime::createFromFormat("d/m/Y",$data[0][2]);
			
				// Si une campagne est en cours
				if($aujourdhui >= $date_debut && $aujourdhui <= $date_fin)
				{
					// A coder : Action de controle sur les EAI ( status 0 - 1 - 2 ) hors de la campagne en cours
				}
				else
				{
					// On met à l'état 4 les EAI à l'état 1 (et 0)
					db_request_update($REQUEST_158,NULL,$this->db_name);
					// On met à l'état 5 les EAI à l'état 2 
					db_request_update($REQUEST_159,NULL,$this->db_name);
				}
			}
		}
		catch (Exception $e)
		{
			throw new Exception($e->getMessage());
		}	
	}
	//============================================================================
	// load_template
	// Chargement de la classe correspondante au modèle d'EAI sélectionné
	// 2 paramètres possible en entréé soit:
	//	-	$id_eai: l'identifiant d'un entretien précis
	//	-	$id_eai_template : l'identifiant d'un modèle
	//	-	$id_client_account: l'identifiant d'un client (car le super-admin peut aller d'un client à l'autre)
	//============================================================================
	private function load_template($id_eai=NULL, $id_eai_template=NULL,$id_client_account=NULL)
	{  
		try
		{
			GLOBAL $REQUEST_173,$MESSAGE_0024,$MESSAGE_0025 ;
			
			$data = NULL;
			
			if($id_eai != NULL){
				$data = $this->get_template_name($id_eai,NULL,$id_client_account) ;
                                if($id_eai_template == NULL){
                                        $tab_arg = array(':id_eai'=> $id_eai);
                                        $result = db_request_select($REQUEST_173,$tab_arg,$this->db_name);
                                        if(count($result)-1==1){
                                            $id_eai_template    =   $result[0][0];
                                        }else{
                                            throw new Exception("No template for eai id ".$id_eai);
                                        }
                                }
                        
                        }elseif($id_eai_template != NULL){
				$data = $this->get_template_name(NULL,$id_eai_template,$id_client_account) ;
                        }
			/*if (file_exists ($classe = $data[0] . '.class.php'))
			{
				require_once $classe;
				return new $data[0]($data[1],$id_eai_template,$id_client_account);
			}
			else
				throw new RuntimeException ($MESSAGE_0024."<strong>".$classe."</strong>".$MESSAGE_0025);*/
                        require_once "sirh_modele.class.php";                        
                        return new sirh_modele($data[1],$id_eai_template,$id_client_account);
		}
		catch (Exception $e)
		{
			throw new Exception($e->getMessage());
		}
	}
	//============================================================================
	// update_eai_template
	//============================================================================
	public function update_eai_template($id_client_account, $id_eai_template, $data)
	{
		try
		{
			$objEAI = $this->load_template(NULL,$id_eai_template,$id_client_account);
			$objEAI->update_eai_template($id_client_account,$id_eai_template, $data);	
			$objEAI = NULL ; 
		}
		catch (Exception $e)
		{
			throw new Exception($e->getMessage());
		}
	}
	//============================================================================
	// show_eai_template
	//============================================================================
	public function show_eai_template($id_client_account, $id_eai_template)
	{
		try
		{
			$objEAI = $this->load_template(NULL,$id_eai_template,$id_client_account);
			$objEAI->show_eai_template($id_client_account , $id_eai_template);
			$objEAI = NULL ; 
		}
		catch (Exception $e)
		{
			throw new Exception($e->getMessage());
		}
	}
	//============================================================================
	// update_eai_stage
	//============================================================================
	public function update_eai_stage($id_eai=NULL, $id_client_account=NULL, $id_eai_template=NULL, $tab_post=NULL)
	{
		try
		{
			$objEAI = $this->load_template($id_eai, $id_eai_template, $id_client_account);
			$data = $objEAI->update_eai_stage($tab_post);
			$objEAI = NULL ; 
			return $data ; 
		}
		catch (Exception $e)
		{
			throw new Exception($e->getMessage());
		}
	}
	//============================================================================
	// check_stage_activate
	//============================================================================
	public function check_stage_activate($id_eai, $stage,$id_client_account)
	{
		try
		{
			$objEAI = $this->load_template($id_eai,NULL,$id_client_account);
			$data = $objEAI->check_stage_activate($stage);
			$objEAI = NULL ; 
			return $data ; 
		}
		catch (Exception $e)
		{
			throw new Exception($e->getMessage());
		}
	}
	//============================================================================
	// check_theme_activate
	//============================================================================
	public function check_theme_activate($id_eai, $theme,$id_client_account)
	{
		try
		{
			$objEAI = $this->load_template($id_eai,NULL,$id_client_account);
			$data = $objEAI->check_theme_activate($theme);
			$objEAI = NULL ; 
			return $data ; 
		}
		catch (Exception $e)
		{
			throw new Exception($e->getMessage());
		}
	}
	//============================================================================
	// show_eai
	// Cette fonction relativement générique s'appelle en 3 modes:
	//  En mode création ($display == $DISPLAY_CREATION) => Dans ce cas les paramètres suivant doivent etre renseignés
	//      -   $id_stage   
	//      -   $id_manager
	//      -   $id_user
	//      -   $id_eai_template
	//      -   $id_client_account
	//  En mode mise à jour ($display == $DISPLAY_UPDATE) => Dans ce cas seul le paramètre $id_eai doit être renseigné
	//  En mode visualisation ($display == $DISPLAY_VISUALISATION) => Dans ce cas seul le paramètre $id_eai doit être renseigné
	//  En mode mise à jour template ($display == $DISPLAY_UPDATE_SUP_ADM) => Dans ce cas seul le paramètre $id_eai doit être renseigné
	//============================================================================
	public function show_eai($display=0,$id_eai=NULL, $id_stage=NULL,$id_manager=NULL, $id_user=NULL, $id_eai_template=NULL,$id_client_account=NULL)
	{
		try
		{
			$objEAI = $this->load_template($id_eai, $id_eai_template,$id_client_account);
			$objEAI->show_eai($display,$id_eai,$id_stage, $id_manager, $id_user);
			$objEAI = NULL;
		}
		catch (Exception $e)
		{
			throw new Exception($e->getMessage());
		}
	}
	//============================================================================
	// delete_user_eai
	//============================================================================
	public function delete_user_eai($id_user,$db_name=NULL)
	{
		try
		{
			GLOBAL $REQUEST_115, $REQUEST_117 ; 
			if($db_name == NULL) $db_name = $this->db_name ; 
			
			$tab_arg = array(':id_user' => $id_user);
			$data = db_request_select($REQUEST_117 , $tab_arg , $db_name);
			
			for($inc=0, $stop=(count($data)-1) ; $inc<$stop; $inc++)
			{
				$this->delete_eai_detail($data[$inc][0],$db_name) ; 
			}
			db_request_delete($REQUEST_115 , $tab_arg , $db_name);
		}
		catch (Exception $e)
		{
			throw new Exception($e->getMessage());
		}
	}
	//============================================================================
	// delete_eai
	//============================================================================
	public function delete_eai($id_eai,$db_name)
	{
		try
		{
			GLOBAL $REQUEST_137 ; 
			
			$this->delete_eai_detail($id_eai,$db_name);
			
			$tab_arg = array(':id_eai' => $id_eai);
			db_request_delete($REQUEST_137 , $tab_arg , $db_name);
		}
		catch (Exception $e)
		{
			throw new Exception($e->getMessage());
		}
	}
	//============================================================================
	// delete_eai_detail
	//============================================================================
	public function delete_eai_detail($id_eai,$db_name)
	{
		try
		{
			GLOBAL $REQUEST_116 ; 
			
			$tab_arg = array(':id_eai' => $id_eai);
			db_request_delete($REQUEST_116 , $tab_arg , $db_name);
		}
		catch (Exception $e)
		{
			throw new Exception($e->getMessage());
		}
	}
	//============================================================================
	// raz_eai_status
	//============================================================================
	public function raz_eai_status($id_eai,$db_name)
	{
		try
		{
			GLOBAL $REQUEST_140 ; 
			
			$tab_arg = array(':id_eai' => $id_eai);
			db_request_update($REQUEST_140 , $tab_arg , $db_name);
		}
		catch (Exception $e)
		{
			throw new Exception($e->getMessage());
		}
	}
	//============================================================================
	// get_template_name
	// Récupération du nom du modèle d'EAI sélectionné
	// 3 paramètres possible en entrée soit:
	//	-	$id_eai: l'identifiant d'un entretien précis
	//	-	$id_eai_template : l'identifiant d'un modèle
	//	-	$id_client_account: l'identifiant d'un client (car le super-admin peut aller d'un client à l'autre)
	// 2 valeurs de sortie :
	//	-	Le nom du modèle
	//	-	La base de données (client) cible qui peut être différent de celui de l'utilisateur connecté dans le cas du Super-Admin
	//============================================================================
	private function get_template_name($id_eai=NULL, $id_eai_template=NULL,$id_client_account=NULL)
	{
		try{
			GLOBAL $REQUEST_009, $REQUEST_102, $REQUEST_110 ; 
			$data = NULL;
			$db_name = $this->db_name ; 
			if($id_client_account != NULL)
			{
				$tab_arg	= array(':param_id_compte_client' 	=> $id_client_account);
				$data1 		= db_request_select($REQUEST_009,$tab_arg,NULL);
				$db_name	= $data1[0][0];
			}
			if($id_eai != NULL)
			{
				$tab_arg	= array(':id_eai' 	=> $id_eai);
				$data 		= db_request_select($REQUEST_102,$tab_arg,$db_name);
			}
			elseif($id_eai_template != NULL)
			{
				$tab_arg	= array(':id_template' 	=> $id_eai_template);
				$data 		= db_request_select($REQUEST_110,$tab_arg,$db_name);
			}
			
			return Array($data[0][0],$db_name) ; 
		}
		catch (Exception $e)
		{
			throw new Exception($e->getMessage());
		}
	}
	//============================================================================
	// get_list_template_client
	//============================================================================
	public function get_list_template_client($id_client_account)
	{
		try{
			GLOBAL $REQUEST_009, $REQUEST_109 ; 
			
			$tab_arg_1	= array(':param_id_compte_client' 	=> $id_client_account);
			$data1 		= db_request_select($REQUEST_009,$tab_arg_1,NULL);
			
			$data2 		= db_request_select($REQUEST_109,NULL,$data1[0][0]);
			
			return $data2 ; 
		}
		catch (Exception $e)
		{
			throw new Exception($e->getMessage());
		}
	}
	//============================================================================
	// show_user_data
	//============================================================================
	private function show_user_data($id_user)
	{
		try{
			GLOBAL  $LABEL_0070,$LABEL_0071,$LABEL_0072,$LABEL_0073,$LABEL_0142,$LABEL_0143,$LABEL_0214,
					$REQUEST_142,$REQUEST_178;
			
			// recherche de la dernière campagne
			$data   =	db_request_select($REQUEST_142,NULL,$this->db_name);
			//Si une campagne est dans la base de données
			if($data != NULL && $data[0][0]!=NULL)
			{
				echo gui_table_tag_open("100%",0,5,0,NULL,NULL,NULL);
					echo gui_tr_tag_open();
						echo gui_td_tag_open();
							echo gui_info_message("<b>".$LABEL_0142." ".$data[0][1]." ".$LABEL_0143." ".$data[0][2]."</b>");
						echo gui_td_tag_close();
					echo gui_tr_tag_close();
					echo gui_tr_tag_empty(1,1);
				echo gui_table_tag_close();
			}
                        // Vérifie si l auto evaluation est disponible
                        $tab_arg    = array(	':id_client' 	=> $this->id_compte_client);
			$data       =	db_request_select($REQUEST_178,$tab_arg);
                       
                        if( $data[0][0] == 1){
                            echo gui_font_tag("titre_2_ssligne",$LABEL_0214);
                            $this->create_its_own_eai($id_user);
                        }
			
			echo gui_font_tag("titre_2_ssligne",$LABEL_0070);
			//$this->get_user_list_appraisal($id_user,self::EAI_STATUS_VALID_MANAGER_TMP); option enlevé par SIRH
			$this->get_user_list_appraisal($id_user,self::EAI_STATUS_VALID_MANAGER_FINAL);
			
			echo gui_font_tag("titre_2_ssligne","<br/>".$LABEL_0072);
			
			echo gui_font_tag("titre_2_ssligne","<br/>".$LABEL_0073."<br/>");
			$this->get_user_list_appraisal($id_user,self::EAI_STATUS_VALID_USER_FINAL);
			$this->get_user_list_appraisal($id_user,self::EAI_STATUS_NO_VALID_MANAGER);
			$this->get_user_list_appraisal($id_user,self::EAI_STATUS_NO_VALID_USER);
		}
		catch (Exception $e)
		{
			throw new Exception($e->getMessage());
		}
	}
	//============================================================================
	// show_manager_data
	//============================================================================
	private function show_manager_data($id_manager)
	{
		try{
			GLOBAL  $LABEL_0104, $LABEL_0105, $LABEL_0106, $LABEL_0127,$LABEL_0142,$LABEL_0143,
					$REQUEST_142;
			
			// recherche de la dernière campagne
			$data   =	db_request_select($REQUEST_142,NULL,$this->db_name);
			//Si une campagne est dans la base de données
			if($data != NULL && $data[0][0]!=NULL)
			{
				echo gui_table_tag_open("100%",0,5,0,NULL,NULL,NULL);
					echo gui_tr_tag_open();
						echo gui_td_tag_open();
							echo gui_info_message("<b>".$LABEL_0142." ".$data[0][1]." ".$LABEL_0143." ".$data[0][2]."</b>");
						echo gui_td_tag_close();
					echo gui_tr_tag_close();
					echo gui_tr_tag_empty(1,1);
				echo gui_table_tag_close();
			}
			// Liste des collaborateurs affiliés à ce manager pour afficher l'option de création d'un nouvel EAI
			echo gui_font_tag("titre_2_ssligne",$LABEL_0104);
			$this->get_manager_list_appraisal($id_manager, self::EAI_STATUS_BLANK ) ; 
			
			echo gui_font_tag("titre_2_ssligne","<br/>".$LABEL_0105."<br/>");
			$this->get_manager_list_appraisal($id_manager, self::EAI_STATUS_VALID_MANAGER_TMP ) ; 
			
			echo gui_font_tag("titre_2_ssligne","<br/>".$LABEL_0106."<br/>");
			$this->get_manager_list_appraisal($id_manager, self::EAI_STATUS_VALID_MANAGER_FINAL ) ; 
			
			echo gui_font_tag("titre_2_ssligne","<br/>".$LABEL_0127."<br/>");
			$this->get_manager_list_appraisal($id_manager, self::EAI_STATUS_VALID_USER_FINAL ) ; 
			$this->get_manager_list_appraisal($id_manager, self::EAI_STATUS_NO_VALID_MANAGER);
			$this->get_manager_list_appraisal($id_manager, self::EAI_STATUS_NO_VALID_USER);
			
		}
		catch (Exception $e)
		{
			throw new Exception($e->getMessage());
		}
	}
	//============================================================================
	// check_period_campaign
	//============================================================================
	public function check_period_campaign()
	{
		GLOBAL $REQUEST_142 ; 
		try
		{
			$campaign_ongoing = false ; 
			
			// recherche de la dernière campagne
			$data   =	db_request_select($REQUEST_142,NULL,$this->db_name);
			
			//Si une campagne est dans la base de données
			if($data != NULL && $data[0][0] !=NULL)
			{
				// Si la date de début est supérieure à la date du jout ET la date de fin de la campagne est inférieure 
				// à la date du jour alors on considère que c'est une campagne d'évaluation en cours de validité
				$aujourdhui = new DateTime("now");
				$date_debut = DateTime::createFromFormat("d/m/Y",$data[0][1]);
				$date_fin   = DateTime::createFromFormat("d/m/Y",$data[0][2]);
			
				if($aujourdhui >= $date_debut && $aujourdhui <= $date_fin)
				{
					$campaign_ongoing = true ; 
				}
			}
			return $campaign_ongoing ; 
		}
		catch (Exception $e)
		{
			throw new Exception($e->getMessage());
		}	
	}
	//============================================================================
	// check_eai_user_exist_in_period_campaign
	//============================================================================
	public function check_eai_user_exist_in_period_campaign($id_user)
	{
		GLOBAL $REQUEST_142,$REQUEST_157  ; 
		try
		{
			$eai_exist = false ; 
			
			// recherche de la dernière campagne
			$data   =	db_request_select($REQUEST_142,NULL,$this->db_name);
			
			//Si une campagne est dans la base de données
			if($data != NULL && $data[0][0] !=NULL)
			{
				// Si la date de début est supérieure à la date du jout ET la date de fin de la campagne est inférieure 
				// à la date du jour alors on considère que c'est une campagne d'évaluation en cours de validité
				$aujourdhui = new DateTime("now");
				$date_debut = DateTime::createFromFormat("d/m/Y",$data[0][1]);
				$date_fin   = DateTime::createFromFormat("d/m/Y",$data[0][2]);
			
				if($aujourdhui >= $date_debut && $aujourdhui <= $date_fin)
				{
					// recherche si le user ne possède pas déjà un EAI dans cette campagne
					$tab_arg		= array(	':id_user'	=> $id_user,
												':date_start' 	=> lib_change_date_gui_to_mysql($data[0][1]),
												':date_end' 	=> lib_change_date_gui_to_mysql($data[0][2])
												);
					$data   =	db_request_select($REQUEST_157,$tab_arg,$this->db_name);
					if($data == NULL || $data[0][0] == NULL)
					{
						$eai_exist = false ; 
					}
					else
						$eai_exist = true ; 
				}
			}
			return $eai_exist ; 
		}
		catch (Exception $e)
		{
			throw new Exception($e->getMessage());
		}	
	}

	//============================================================================
	// insert_campaign
	//============================================================================
	public function insert_campaign($date_start,$date_end)
	{
		GLOBAL $REQUEST_143 ; 
		try
		{
			$tab_arg = array(   ':date_start'  => $date_start,':date_end' => $date_end);
			db_request_insert($REQUEST_143,$tab_arg,$this->db_name);
		}
		catch (Exception $e)
		{
			throw new Exception($e->getMessage());
		}	
	}
	
	//============================================================================
	// update_campaign
	//============================================================================
	public function update_campaign($id_campaign,$date_start,$date_end)
	{
		GLOBAL $REQUEST_144 ; 
		try
		{
			// A Coder: Attention aux EAI orphelines si modification des dates des campagnes alors que des EAI sont en cours 
			$tab_arg = array(':id_campaign'  => $id_campaign,':date_start'  => $date_start,':date_end' => $date_end);
			db_request_update($REQUEST_144,$tab_arg,$this->db_name);
			
			$this->update_eai_status();
		}
		catch (Exception $e)
		{
			throw new Exception($e->getMessage());
		}	
	}
	//============================================================================
	// show_hr_expert_data
	//============================================================================
	private function show_hr_expert_data()
	{
		try{
			GLOBAL  $DISPLAY_CREATION , $DISPLAY_VISUALISATION, $DISPLAY_UPDATE,
					$LABEL_0142,$LABEL_0143,$LABEL_0151,$LABEL_0152,$LABEL_0153,
					$REQUEST_050,$REQUEST_142,$REQUEST_149,$REQUEST_150,$REQUEST_151,
					$PATH_EAI, $PAGE_0004,
					$ICON_ADD,$ICON_UPDATE,$ICON_VISUALISATION;
			
			// recherche de la dernière campagne
			$data   =	db_request_select($REQUEST_142,NULL,$this->db_name);
			
			echo	gui_jqueryui_ul_open();
			//Si une campagne est dans la base de données
			if($data != NULL && $data[0][0]!=NULL)
			{
				echo gui_table_tag_open("100%",0,5,0,NULL,NULL,NULL);
					echo gui_tr_tag_open();
						echo gui_td_tag($LABEL_0142." ".$data[0][1]." ".$LABEL_0143." ".$data[0][2],"","left",NULL,NULL,NULL,"td_data_bold",NULL,NULL) ; 
						echo gui_td_tag_open("","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
							echo gui_jqueryui_li_icon($ICON_UPDATE,"onclick=\"javascript: $('#dialog_update').dialog('open');\"");				
						echo gui_td_tag_close();
						echo gui_td_tag(" ");
					echo gui_tr_tag_close();
					
					echo gui_tr_tag_open();
						echo gui_td_tag_open(NULL,NULL,NULL,3,NULL,NULL,NULL,NULL) ;
							$this->show_dashboard_campaign($data[0][0]); 
						echo gui_td_tag_close();
					echo gui_tr_tag_close();
					echo gui_tr_tag_empty(1,3);
					//=========================================================================================
					// Consulter un entretien clôturé
					echo gui_tr_tag_open();
						
						$tab_arg    = array(':id_campaign' => $data[0][0]);
						$data_5     = db_request_select($REQUEST_150,$tab_arg,$this->db_name);
						echo gui_form_post_open("form_eai_closed",$PATH_EAI.$PAGE_0004);
						echo gui_td_tag($LABEL_0151." :","","left",NULL,NULL,NULL,"td_data_bold",NULL,NULL) ; 
						echo gui_td_tag_open("","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
							echo gui_form_select_field("id_eai","id_eai",$data_5,"",false,"",2, 0, false);
						echo gui_td_tag_close() ; 
						echo gui_td_tag_open("","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
							echo	gui_form_input_hidden_field("operation","eai_visualisation");
							echo gui_jqueryui_li_icon($ICON_VISUALISATION,"onclick=\"javascript: load_img(); document.form_eai_closed.submit();\"");
						echo gui_td_tag_close() ; 
						echo gui_form_post_close();
					echo gui_tr_tag_close();
					
					echo gui_tr_tag_empty(1,3);
					//=========================================================================================
					// Suivre la situation d'un collaborateur
					echo gui_tr_tag_open();
						$tab_arg    = array(':id_campaign' => $data[0][0]);
						$data_5     = db_request_select($REQUEST_151,$tab_arg,$this->db_name);
						echo gui_form_post_open("form_select_eai",$PATH_EAI.$PAGE_0004);
						echo gui_td_tag($LABEL_0152." :","","left",NULL,2,NULL,"td_data_bold",NULL,NULL) ; 
						echo gui_td_tag_open("","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
							echo	gui_form_input_hidden_field("operation","eai_visualisation");
							echo gui_jqueryui_li_icon($ICON_VISUALISATION,"onclick=\"javascript: load_img(); document.form_select_eai.submit();\"");
						echo gui_td_tag_close() ; 
					echo gui_tr_tag_close();
					echo gui_tr_tag_open();
						echo gui_td_tag_open("","left",NULL,3,NULL,NULL,NULL,NULL) ; 
							echo gui_form_select_field("id_eai","id_eai",$data_5,"",false,"",4, 0, false);
						echo gui_td_tag_close() ; 
						echo gui_form_post_close();
					echo gui_tr_tag_close();
					
					echo gui_tr_tag_empty(1,3);
					//=========================================================================================
					// Suivre la situation d'une équipe
					echo gui_tr_tag_open();
						$tab_arg    = array(':id_campaign' => $data[0][0]);
						$data_5     = db_request_select($REQUEST_050,$tab_arg,$this->db_name);
						echo gui_td_tag($LABEL_0153." :","","left",NULL,3,NULL,"td_data_bold",NULL,NULL) ; 
					echo gui_tr_tag_close();
					echo gui_tr_tag_open();
						echo gui_td_tag_open("","left",NULL,3,NULL,NULL,NULL,NULL) ; 
							
								echo gui_form_input_hidden_field("id_campaign",$data[0][0]);
								echo gui_form_select_field("select_manager","select_manager",$data_5,"",false,"",3, 101);	
							
						echo gui_td_tag_close() ; 
					echo gui_tr_tag_close();
					echo gui_tr_tag_open();
						echo gui_td_tag_open(NULL,NULL,NULL,3,NULL,NULL,NULL,NULL) ;
							echo gui_div_tag_open("refresh_campaign_per_manager");
								$this->show_dashboard_campaign($data[0][0],$data_5[0][0]); 
							echo gui_div_tag_close();
						echo gui_td_tag_close();
					echo gui_tr_tag_close();
					
				echo gui_table_tag_close();
			}
			echo	gui_jqueryui_ul_close();
		}
		catch (Exception $e)
		{
			throw new Exception($e->getMessage());
		}
	}
	//============================================================================
	// show_dashboard_campaign
	//============================================================================
	public function show_dashboard_campaign($id_campaign,$id_manager=NULL)
	{
		GLOBAL  $LABEL_0032,$LABEL_0077,$LABEL_0105,$LABEL_0139,$LABEL_0148,$LABEL_0149,$LABEL_0150,
				$REQUEST_145,$REQUEST_146,$REQUEST_147,$REQUEST_148,$REQUEST_149,$REQUEST_152,$REQUEST_153,$REQUEST_154,$REQUEST_155,$REQUEST_156,
				$PATH_EAI, $PAGE_0004,
				$ICON_VISUALISATION;
		try
		{
			echo gui_table_tag_open("100%",0,5,1,NULL,NULL,NULL);
				// Je colle ici les DIV caché des fenêtres
				echo gui_tr_tag_open();
					echo gui_td_tag_open(NULL,NULL,NULL,6,NULL,NULL,NULL,NULL) ;
					
					// On a deux possiblité soit par campagne seule soit par campagne et filtre sur manager
					if($id_manager==NULL)
					{
						$tab_arg    = array(':id_campaign' => $id_campaign);
						$data_1     = db_request_select($REQUEST_145,$tab_arg,$this->db_name);
						$data_2     = db_request_select($REQUEST_146,$tab_arg,$this->db_name);
						$data_3     = db_request_select($REQUEST_147,$tab_arg,$this->db_name);
						$data_4     = db_request_select($REQUEST_148,$tab_arg,$this->db_name);
						$data_5     = db_request_select($REQUEST_149,$tab_arg,$this->db_name);
					}
					else
					{
						$tab_arg_1  = array(':id_manager' => $id_manager);
						$tab_arg    = array(':id_campaign' => $id_campaign,':id_manager' => $id_manager);
						$data_1     = db_request_select($REQUEST_152,$tab_arg_1,$this->db_name);
						$data_2     = db_request_select($REQUEST_153,$tab_arg,$this->db_name);
						$data_3     = db_request_select($REQUEST_154,$tab_arg,$this->db_name);
						$data_4     = db_request_select($REQUEST_155,$tab_arg,$this->db_name);
						$data_5     = db_request_select($REQUEST_156,$tab_arg,$this->db_name);
					}
					
					echo gui_div_tag_open("dialog_user_eai_to_be_done".(($id_manager!=NULL)?"_per_manager":""),NULL,NULL,$LABEL_0148);
						echo gui_table_tag_open("100%",0,5,0,NULL,NULL,NULL);
							for($inc=0,$stop=(count($data_1)-1) ; $inc<$stop; $inc++)
							{
								echo gui_tr_tag_open();
									echo gui_td_tag($data_1[$inc][1]." ".$data_1[$inc][2]." - ".Strings::LABEL_0044." : ".$data_1[$inc][3]) ;
								echo gui_tr_tag_close();	
							}
						echo gui_table_tag_close();
					echo gui_div_tag_close();
					
					echo gui_div_tag_open("dialog_user_eai_remaining".(($id_manager!=NULL)?"_per_manager":""),NULL,NULL,$LABEL_0149);
						echo gui_table_tag_open("100%",0,5,0,NULL,NULL,NULL);
							for($inc=0,$stop=(count($data_2)-1) ; $inc<$stop; $inc++)
							{
								echo gui_tr_tag_open();
									echo gui_td_tag($data_2[$inc][1]." ".$data_2[$inc][2]." - ".Strings::LABEL_0044." : ".$data_2[$inc][3]) ;
								echo gui_tr_tag_close();	
							}
						echo gui_table_tag_close();
					echo gui_div_tag_close();
					
					echo gui_div_tag_open("dialog_user_eai_ongoing".(($id_manager!=NULL)?"_per_manager":""),NULL,NULL,$LABEL_0105);
						echo gui_jqueryui_ul_open();
						echo gui_table_tag_open("100%",0,5,0,NULL,NULL,NULL);
							for($inc=0,$stop=(count($data_3)-1) ; $inc<$stop; $inc++)
							{
								echo gui_tr_tag_open();
									echo gui_td_tag($data_3[$inc][1]." ".$data_3[$inc][2]." - ".Strings::LABEL_0044." : ".$data_3[$inc][4]." - ".$LABEL_0077." : ".$data_3[$inc][5]) ;
									echo gui_td_tag_open(NULL,NULL,"left",NULL,NULL,NULL,NULL,NULL) ;
										echo 	gui_form_post_open("campaign_eai_ongoing_".$inc.(($id_manager!=NULL)?"_per_manager":""),$PATH_EAI.$PAGE_0004);
											echo	gui_form_input_hidden_field("operation","eai_visualisation");
											echo	gui_form_input_hidden_field("id_eai",$data_3[$inc][3]);	
											echo 	gui_jqueryui_li_icon($ICON_VISUALISATION,"onclick=\"javascript: load_img(); document.campaign_eai_ongoing_".$inc.(($id_manager!=NULL)?"_per_manager":"").".submit();\"");				
										echo 	gui_form_post_close();
									echo gui_td_tag_close() ;
								echo gui_tr_tag_close();	
							}
						echo gui_table_tag_close();
						echo gui_jqueryui_ul_close();
					echo gui_div_tag_close();
					
					echo gui_div_tag_open("dialog_user_eai_waiting_validation".(($id_manager!=NULL)?"_per_manager":""),NULL,NULL,$LABEL_0139);
					echo gui_jqueryui_ul_open();
						echo gui_table_tag_open("100%",0,5,0,NULL,NULL,NULL);	
							for($inc=0,$stop=(count($data_4)-1) ; $inc<$stop; $inc++)
							{
								echo gui_tr_tag_open();
									echo gui_td_tag($data_4[$inc][1]." ".$data_4[$inc][2]." - ".Strings::LABEL_0044." : ".$data_4[$inc][4]." - ".$LABEL_0077." : ".$data_4[$inc][5]) ;
									echo gui_td_tag_open(NULL,NULL,"left",NULL,NULL,NULL,NULL,NULL) ;
										echo 	gui_form_post_open("campaign_eai_waiting_validation_".$inc.(($id_manager!=NULL)?"_per_manager":""),$PATH_EAI.$PAGE_0004);
											echo	gui_form_input_hidden_field("operation","eai_visualisation");
											echo	gui_form_input_hidden_field("id_eai",$data_4[$inc][3]);	
											echo 	gui_jqueryui_li_icon($ICON_VISUALISATION,"onclick=\"javascript: load_img(); document.campaign_eai_waiting_validation_".$inc.(($id_manager!=NULL)?"_per_manager":"").".submit();\"");				
										echo 	gui_form_post_close();
									echo gui_td_tag_close() ;
								echo gui_tr_tag_close();	
							}
						echo gui_table_tag_close();
						echo gui_jqueryui_ul_close();	
					echo gui_div_tag_close();
					
					echo gui_div_tag_open("dialog_user_eai_closed".(($id_manager!=NULL)?"_per_manager":""),NULL,NULL,$LABEL_0150);
						echo gui_jqueryui_ul_open();
						echo gui_table_tag_open("100%",0,5,0,NULL,NULL,NULL);
							for($inc=0,$stop=(count($data_5)-1) ; $inc<$stop; $inc++)
							{
								echo gui_tr_tag_open();
									echo gui_td_tag($data_5[$inc][1]." ".$data_5[$inc][2]." - ".Strings::LABEL_0044." : ".$data_5[$inc][4]." - ".$LABEL_0077." : ".$data_5[$inc][5]) ;
									echo gui_td_tag_open(NULL,NULL,"left",NULL,NULL,NULL,NULL,NULL) ;
										echo 	gui_form_post_open("campaign_eai_closed_".$inc.(($id_manager!=NULL)?"_per_manager":""),$PATH_EAI.$PAGE_0004);
											echo	gui_form_input_hidden_field("operation","eai_visualisation");
											echo	gui_form_input_hidden_field("id_eai",$data_5[$inc][3]);	
											echo 	gui_jqueryui_li_icon($ICON_VISUALISATION,"onclick=\"javascript: load_img(); document.campaign_eai_closed_".$inc.(($id_manager!=NULL)?"_per_manager":"").".submit();\"");
										echo 	gui_form_post_close();
									echo gui_td_tag_close() ;
								echo gui_tr_tag_close();	
							}
						echo gui_table_tag_close();
						echo gui_jqueryui_ul_close();
					echo gui_div_tag_close();
					
					echo gui_td_tag_close();
				echo gui_tr_tag_close();	
				// Fin des DIV caché des fenêtres
				
				echo gui_tr_tag_open();
					echo gui_td_tag($LABEL_0148." (".(count($data_1)-1).")",NULL,NULL,"left",NULL,NULL,NULL,NULL,NULL) ;
					echo gui_td_tag_open(NULL,NULL,"left",NULL,NULL,NULL,NULL,NULL) ;
						echo gui_jqueryui_li_icon($ICON_VISUALISATION,"onclick=\"javascript: $('#dialog_user_eai_to_be_done".(($id_manager!=NULL)?"_per_manager":"")."').dialog('open');\"");
					echo gui_td_tag_close();
					
					echo gui_td_tag($LABEL_0149." (".(count($data_2)-1).")",NULL,NULL,"left",NULL,NULL,NULL,NULL,NULL) ;
					echo gui_td_tag_open(NULL,NULL,"left",NULL,NULL,NULL,NULL,NULL) ;
						echo gui_jqueryui_li_icon($ICON_VISUALISATION,"onclick=\"javascript: $('#dialog_user_eai_remaining".(($id_manager!=NULL)?"_per_manager":"")."').dialog('open');\"");
					echo gui_td_tag_close();
					
					echo gui_td_tag($LABEL_0105." (".(count($data_3)-1).")",NULL,NULL,"left",NULL,NULL,NULL,NULL,NULL) ;
					echo gui_td_tag_open(NULL,NULL,"left",NULL,NULL,NULL,NULL,NULL) ;
						echo gui_jqueryui_li_icon($ICON_VISUALISATION,"onclick=\"javascript: $('#dialog_user_eai_ongoing".(($id_manager!=NULL)?"_per_manager":"")."').dialog('open');\"");
					echo gui_td_tag_close();
				echo gui_tr_tag_close();	
				echo gui_tr_tag_open();
					echo gui_td_tag($LABEL_0139." (".(count($data_4)-1).")",NULL,NULL,"left",NULL,NULL,NULL,NULL,NULL) ;
					echo gui_td_tag_open(NULL,NULL,"left",NULL,NULL,NULL,NULL,NULL) ;
						echo gui_jqueryui_li_icon($ICON_VISUALISATION,"onclick=\"javascript: $('#dialog_user_eai_waiting_validation".(($id_manager!=NULL)?"_per_manager":"")."').dialog('open');\"");
					echo gui_td_tag_close();
					
					echo gui_td_tag($LABEL_0150." (".(count($data_5)-1).")",NULL,NULL,"left",NULL,NULL,NULL,NULL,NULL) ;
					echo gui_td_tag_open(NULL,NULL,"left",3,NULL,NULL,NULL,NULL) ;
						echo gui_jqueryui_li_icon($ICON_VISUALISATION,"onclick=\"javascript: $('#dialog_user_eai_closed".(($id_manager!=NULL)?"_per_manager":"")."').dialog('open');\"");
					echo gui_td_tag_close();
				echo gui_tr_tag_close();
			echo gui_table_tag_close();		
		}
		catch (Exception $e)
		{
			throw new Exception($e->getMessage());
		}
	}
	//============================================================================
	// show_form_campaign
	//============================================================================
	public function show_form_campaign($data=NULL, $type_affichage=0)
	{
		GLOBAL 	$DISPLAY_CREATION , $DISPLAY_VISUALISATION, $DISPLAY_UPDATE,$CHECK_DATE,
			$LABEL_0144,$LABEL_0145,$LABEL_0146,$LABEL_0147;
		
		if($type_affichage == $DISPLAY_CREATION)
		{
			echo gui_div_tag_open("dialog_creation",NULL,NULL,Strings::LABEL_0009);
				echo gui_form_post_open("campaign_creation");
					echo gui_form_input_hidden_field("operation" ,"campaign_creation");
		}
		elseif($type_affichage == $DISPLAY_UPDATE)
		{
			echo gui_div_tag_open("dialog_update",NULL,NULL,Strings::LABEL_0033);
				echo gui_form_post_open("campaign_update");
					echo gui_form_input_hidden_field("operation" ,"campaign_update");
					echo gui_form_input_hidden_field("id_campaign" ,$data[0]);
		}
		
			echo gui_table_tag_open("100%",0,5,0,NULL,NULL,NULL);
			
				//début cartouche titre
				echo gui_tr_tag_open();
				
		if($type_affichage == $DISPLAY_CREATION)
			echo gui_td_tag($LABEL_0144,NULL,"left",NULL,4,NULL,"td_data_bold",NULL,NULL) ; 
		elseif($type_affichage == $DISPLAY_UPDATE)
			echo gui_td_tag($LABEL_0145,NULL,"left",NULL,4,NULL,"td_data_bold",NULL,NULL) ; 
				
				echo gui_tr_tag_close();
				
                                //fin cartouche titre
				
				echo gui_tr_tag_open();
				
					echo gui_td_tag("<label for=\"campaign_date_start\">".$LABEL_0146."</label>") ;
					echo "<a href=\"#\"> </a>"; //Astuce ALC pour éviter de le datepicker ait le focus et s'ouvre intenpestivement
					$string_data = "&nbsp;" ;
					if($type_affichage      == $DISPLAY_CREATION)   $string_data .= gui_form_input_text_field("date_start_creation","",11,10,"datepicker_creation_start_campaign",true,false,$CHECK_DATE);
					elseif($type_affichage  == $DISPLAY_UPDATE)		$string_data .= gui_form_input_text_field("date_start_update",$data[1],11,10,"datepicker_update_start_campaign",true,false,$CHECK_DATE);
					echo gui_td_tag($string_data);
					
					echo gui_td_tag("<label for=\"campaign_date_end\">".$LABEL_0147."</label>"); 
					$string_data = "" ;
					if($type_affichage      == $DISPLAY_CREATION)   $string_data .= gui_form_input_text_field("date_end_creation","",11,10,"datepicker_creation_end_campaign",true,false,$CHECK_DATE);
					elseif($type_affichage  == $DISPLAY_UPDATE) 	$string_data .= gui_form_input_text_field("date_end_update",$data[2],11,10,"datepicker_update_end_campaign",true,false,$CHECK_DATE);
					echo gui_td_tag($string_data);
				
				echo gui_tr_tag_close();
			echo gui_table_tag_close();
				
		if($type_affichage == $DISPLAY_CREATION)
		{
				echo gui_form_post_close();
			echo gui_div_tag_close();
		}
		elseif($type_affichage == $DISPLAY_UPDATE)
		{
				echo gui_form_post_close();
			echo gui_div_tag_close();
		}
	}
	//============================================================================
	// get_user_list_appraisal
	//============================================================================
	private function get_user_list_appraisal($param_id_user,$param_statut_eai)
	{
		GLOBAL  $REQUEST_101, 
				$LABEL_0074, $LABEL_0117, $LABEL_0118, $LABEL_0119,$LABEL_0120,$LABEL_0155,$LABEL_0156,
				$DISPLAY_VISUALISATION ,$DISPLAY_UPDATE_EVALUE , $MOVE_NEUTRAL,
				$PATH_EAI, $PAGE_0004, $ICON_VISUALISATION,$ICON_UPDATE, $ICON_PDF ;
		try
		{	
			$tab_arg		= array(	':id_user' 	=> $param_id_user,
										':id_status'=> $param_statut_eai);

                        
			$data = db_request_select($REQUEST_101,$tab_arg,$this->db_name);
			
			echo	gui_jqueryui_ul_open();
			echo    gui_table_tag_open(0,5,0,0,NULL,NULL,NULL);
			
			for($inc=0, $stop=(count($data)-1) ; $inc<$stop; $inc++)
			{
				echo gui_tr_tag_open();
				// option visualisation
				if($param_statut_eai == self::EAI_STATUS_VALID_MANAGER_TMP)
				{
			
					echo gui_td_tag_open();
						echo $LABEL_0074." ".$LABEL_0120." ".$data[$inc][2].", ".$LABEL_0117 ; 
					echo gui_td_tag_close();
					
					echo gui_td_tag_open();
						echo 	gui_form_post_open("eai_ongoing_".$inc,$PATH_EAI.$PAGE_0004);
							echo	gui_form_input_hidden_field("operation","eai_visualisation");
							echo	gui_form_input_hidden_field("id_eai",$data[$inc][0]);	

							echo 	gui_jqueryui_li_icon($ICON_VISUALISATION,"onclick=\"javascript: load_img();
																									document.eai_ongoing_".$inc.".submit();\"");

						echo 	gui_form_post_close();
					echo gui_td_tag_close();
				}
				elseif($param_statut_eai == self::EAI_STATUS_VALID_MANAGER_FINAL)
				{
					echo gui_td_tag_open();
							echo $LABEL_0074." ".$LABEL_0120." ".$data[$inc][2].", ".$LABEL_0118 ; 
					echo gui_td_tag_close();
					echo gui_td_tag_open();
						echo 	gui_form_post_open("eai_update_evalue_".$inc,$PATH_EAI.$PAGE_0004);
							
							echo	gui_form_input_hidden_field("operation","eai_update_stage");
							echo	gui_form_input_hidden_field("id_eai",$data[$inc][0]);	
							echo	gui_form_input_hidden_field("id_stage",1);	//l'étape va s'incrémenter de 1
							echo	gui_form_input_hidden_field("requete",$DISPLAY_UPDATE_EVALUE);
							echo    gui_form_input_hidden_field("move" ,$MOVE_NEUTRAL);
							
							// option mise à jour validé si nous sommes dans une période de campagne valide
						if($this->check_period_campaign())
							echo 	gui_jqueryui_li_icon($ICON_UPDATE,"onclick=\"javascript: document.eai_update_evalue_".$inc.".submit();\"");
						else
							echo    gui_jqueryui_li_icon($ICON_UPDATE,"onclick=\"javascript: $('#dialog_info_campaign').dialog('open');\"");

						echo 	gui_form_post_close();
					echo gui_td_tag_close();
				}
				elseif( $param_statut_eai == self::EAI_STATUS_VALID_USER_FINAL )
				{
					if($param_statut_eai == self::EAI_STATUS_NO_VALID_MANAGER)
					{
							echo gui_td_tag_open(NULL,NULL,NULL,2);
								echo gui_font_tag("commentaire",$LABEL_0155);
							echo gui_td_tag_close();
						echo gui_tr_tag_close();
						echo gui_tr_tag_open();
					}
					elseif($param_statut_eai == self::EAI_STATUS_NO_VALID_USER)
					{
							echo gui_td_tag_open(NULL,NULL,NULL,2);
								echo gui_font_tag("commentaire",$LABEL_0156);
							echo gui_td_tag_close();
						echo gui_tr_tag_close();
						echo gui_tr_tag_open();
					}
					echo gui_td_tag_open();
						echo $LABEL_0074." ".$LABEL_0120." ".$data[$inc][2].", ".$LABEL_0119; 
					echo gui_td_tag_close();
					echo gui_td_tag_open();
						echo 	gui_form_post_open("eai_".$inc,$PATH_EAI.$PAGE_0004);
							echo	gui_form_input_hidden_field("operation","eai_visualisation");
							echo	gui_form_input_hidden_field("id_eai",$data[$inc][0]);	
							
							echo 	gui_jqueryui_li_icon($ICON_VISUALISATION,"onclick=\"javascript: load_img(); document.eai_".$inc.".submit();\"");
							
							echo 	gui_jqueryui_li_icon($ICON_PDF,"onclick=\"javascript: load_img();
								document.forms['eai_$inc'].elements['operation'].value = 'eai_pdf'; 
								document.eai_".$inc.".submit()\"");
							
						echo 	gui_form_post_close();
					echo gui_td_tag_close();
				}
				elseif( $param_statut_eai == self::EAI_STATUS_NO_VALID_MANAGER)
				{
					echo gui_td_tag_open(NULL,NULL,NULL,2);
						echo gui_font_tag("commentaire",$LABEL_0155);
					echo gui_td_tag_close();
					
				echo gui_tr_tag_close();
				echo gui_tr_tag_open();
					
					echo gui_td_tag_open();
						echo $LABEL_0074." ".$LABEL_0120." ".$data[$inc][2].", ".$LABEL_0119; 
					echo gui_td_tag_close();
					echo gui_td_tag_open();
						echo 	gui_form_post_open("eai_no_valid_manager_".$inc,$PATH_EAI.$PAGE_0004);
							echo	gui_form_input_hidden_field("operation","eai_visualisation");
							echo	gui_form_input_hidden_field("id_eai",$data[$inc][0]);	
							
							echo 	gui_jqueryui_li_icon($ICON_VISUALISATION,"onclick=\"javascript: load_img(); document.eai_no_valid_manager_".$inc.".submit();\"");
							
							echo 	gui_jqueryui_li_icon($ICON_PDF,"onclick=\"javascript: load_img();
								document.forms['eai_no_valid_manager_$inc'].elements['operation'].value = 'eai_pdf'; 
								document.eai_no_valid_manager_".$inc.".submit()\"");
							
						echo 	gui_form_post_close();
					echo gui_td_tag_close();
				}
				elseif( $param_statut_eai == self::EAI_STATUS_NO_VALID_USER)
				{
					echo gui_td_tag_open(NULL,NULL,NULL,2);
						echo gui_font_tag("commentaire",$LABEL_0156);
					echo gui_td_tag_close();
				echo gui_tr_tag_close();
				echo gui_tr_tag_open();
				
					echo gui_td_tag_open();
						echo $LABEL_0074." ".$LABEL_0120." ".$data[$inc][2].", ".$LABEL_0119; 
					echo gui_td_tag_close();
					echo gui_td_tag_open();
						echo 	gui_form_post_open("eai_no_valid_user_".$inc,$PATH_EAI.$PAGE_0004);
							echo	gui_form_input_hidden_field("operation","eai_visualisation");
							echo	gui_form_input_hidden_field("id_eai",$data[$inc][0]);	
							
							echo 	gui_jqueryui_li_icon($ICON_VISUALISATION,"onclick=\"javascript: load_img(); document.eai_no_valid_user_".$inc.".submit();\"");
							
							echo 	gui_jqueryui_li_icon($ICON_PDF,"onclick=\"javascript: load_img();
								document.forms['eai_no_valid_user_$inc'].elements['operation'].value = 'eai_pdf'; 
								document.eai_no_valid_user_".$inc.".submit()\"");
							
						echo 	gui_form_post_close();
					echo gui_td_tag_close();
				}
				
				echo gui_tr_tag_close();
			}
			echo gui_table_tag_close();
			echo gui_jqueryui_ul_close();
		}
		catch (Exception $e)
		{
			throw new Exception($e->getMessage());
		}
	}
	//============================================================================
	// get_manager_list_appraisal
	//============================================================================
	private function get_manager_list_appraisal($param_id_manager,$param_statut_eai)
	{
		GLOBAL  $LABEL_0100 , $LABEL_0131,$LABEL_0155,$LABEL_0156,
				$REQUEST_027, $REQUEST_109, $REQUEST_134,$MOVE_NEUTRAL,
				$DISPLAY_VISUALISATION,$DISPLAY_UPDATE,
				$ICON_VISUALISATION,$ICON_ADD,$ICON_UPDATE,$ICON_NEW_PDF,$ICON_PDF,$ICON_DELETE,
				$PATH_EAI, $PAGE_0004 ;
		try
		{	
			echo	gui_jqueryui_ul_open();	
			$iter = 0 ;
			//====================================================================
			// La fonction est appelé en mode de création d'EAI
			if($param_statut_eai == self::EAI_STATUS_BLANK)
			{
				$tab_arg		= array(	':id_user' 	=> $param_id_manager);
				$data = db_request_select($REQUEST_027,$tab_arg,$this->db_name);
				echo    gui_table_tag_open("",5,0,0,NULL,NULL,NULL);
				
				for($inc=0, $stop=(count($data)-1) ; $inc<$stop; $inc++)
				{
					$iter = $inc ; 
					if($iter%2 == 0) echo gui_tr_tag_open(); //permet de mettre 2 collaborateurs par ligne
					
					echo 	gui_form_post_open("eai_creation_".$inc,$PATH_EAI.$PAGE_0004);
						
						echo	gui_form_input_hidden_field("operation","eai_creation");
						echo	gui_form_input_hidden_field("id_manager",$param_id_manager);	
						echo	gui_form_input_hidden_field("id_user",$data[$inc][0]);	
						echo	gui_form_input_hidden_field("id_stage",1);	//De fait on affiche la première étape de la création de l'EAI
						
						echo gui_td_tag($data[$inc][1]." ".$data[$inc][2],NULL,"left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
					
						// option création en fonction de l'existance d'une campagne active en cours
						if(!$this->check_period_campaign())
						{
							$icon =  	gui_jqueryui_li_icon($ICON_ADD,"onclick=\"javascript: $('#dialog_info_campaign').dialog('open');\"");
						}
						else
						{
							if($this->check_eai_user_exist_in_period_campaign($data[$inc][0]))
								$icon =  	gui_jqueryui_li_icon($ICON_ADD,"onclick=\"javascript: $('#dialog_info_eai_user_exist').dialog('open');\"");
							else 
								$icon =  	gui_jqueryui_li_icon($ICON_ADD,"onclick=\"javascript: document.eai_creation_".$inc.".submit();\"");
						}
							
						$icon2 =  	gui_jqueryui_li_icon($ICON_NEW_PDF,"onclick=\"javascript: load_img();
																	document.forms['eai_creation_".$inc."'].elements['operation'].value = 'eai_pdf'; 
																	document.eai_creation_".$inc.".submit()\"");
																	
						//================================================
						//selection d'un modèle
						//================================================
						$data_2 = db_request_select($REQUEST_109 , NULL , $this->db_name);
						$select_data_2 = gui_form_select_field("select_eai_template_creation","select_eai_template_creation",$data_2,"",false,"",0,0) ; 
						
						echo    gui_td_tag(" - ".$LABEL_0100,NULL,"left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
						echo    gui_td_tag($select_data_2,NULL,"left",NULL,NULL,NULL,NULL,NULL,NULL);
						
						echo    gui_td_tag($icon,NULL,"left",NULL,NULL,NULL,NULL,NULL,NULL);    
						echo    gui_td_tag($icon2,NULL,"left",NULL,NULL,NULL,NULL,NULL,NULL);    
						
					echo 	gui_form_post_close();
					
					if($iter%2 == 0) echo    gui_td_tag("",20); //permet de mettre de l'espace entre chaque collaborateur par ligne
					if($iter%2 != 0) echo gui_tr_tag_close(); //permet de mettre 2 collaborateurs par ligne
				}
				//if($iter!=0  && $iter%2 != 0)   echo   gui_tr_tag_close(); //permet de mettre 2 collaborateurs par ligne et de fermer la ligne
				
				echo gui_table_tag_close();
			}
			//====================================================================
			// La fonction est appelé en mode de mise à jour d'un EAI par le manager
			elseif( $param_statut_eai == self::EAI_STATUS_VALID_MANAGER_TMP)
			{
				$tab_arg		= array(	':id_user' 	=> $param_id_manager,
											':id_status' => $param_statut_eai
										);
				$data = db_request_select($REQUEST_134,$tab_arg,$this->db_name);
				
				echo    gui_table_tag_open("",5,0,0,NULL,NULL,NULL);
				
				for($inc=0, $stop=(count($data)-1) ; $inc<$stop; $inc++)
				{
					$iter = $inc ; 
					if($iter%3 == 0) echo gui_tr_tag_open(); //permet de mettre 3 collaborateurs par ligne
					
					echo 	gui_form_post_open("eai_update_".$inc,$PATH_EAI.$PAGE_0004);
						
						echo	gui_form_input_hidden_field("operation","eai_update_stage");
						echo	gui_form_input_hidden_field("id_eai",$data[$inc][0]);	
						echo	gui_form_input_hidden_field("id_stage",1);	//De fait on affiche la première étape (le 2 sera décrémenté en 1 dans eai.php) de la création de l'EAI 
						echo	gui_form_input_hidden_field("requete",$DISPLAY_UPDATE);
						echo    gui_form_input_hidden_field("move" ,$MOVE_NEUTRAL);
						
						echo    gui_td_tag($data[$inc][5]." - ".$data[$inc][2]." ".$data[$inc][3],"","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
					
						// option mise à jour validé si nous sommes dans une période de campagne valide
						if($this->check_period_campaign())
							$icon =  	gui_jqueryui_li_icon($ICON_UPDATE,"onclick=\"javascript: document.eai_update_".$inc.".submit();\"");
						else
							$icon =  	gui_jqueryui_li_icon($ICON_UPDATE,"onclick=\"javascript: $('#dialog_info_campaign').dialog('open');\"");
						
					echo 	gui_form_post_close();
					        
					// option de visualisation
                                        echo     gui_form_post_open("eai_visu_tmp_".$inc,$PATH_EAI.$PAGE_0004);
                                        echo    gui_form_input_hidden_field("operation","eai_visualisation");
                                        echo    gui_form_input_hidden_field("id_eai",$data[$inc][0]);   
                                        $visu = gui_jqueryui_li_icon($ICON_VISUALISATION,"onclick=\"javascript: document.eai_visu_tmp_".$inc.".submit();\"");
                                        echo     gui_form_post_close();
                        
                                         $pdf 	= gui_jqueryui_li_icon($ICON_PDF,"onclick=\"javascript: load_img();
																					document.forms['eai_visu_tmp_".$inc."'].elements['operation'].value = 'eai_pdf'; 
																					document.eai_visu_tmp_".$inc.".submit()\"");
				    
					// Option de suppresion
					echo    gui_form_post_open("eai_delete_by_manager_".$inc."");
					
						echo gui_form_input_hidden_field("operation" ,"eai_delete");
						echo gui_form_input_hidden_field("select_id_eai" ,$data[$inc][0]);
							
						$delete = gui_jqueryui_li_icon($ICON_DELETE,"onclick=\"javascript: $('#dialog_del_eai_by_manager_".$inc."').dialog('open');\"");
					echo gui_form_post_close();
					
					echo    gui_td_tag($icon.$visu.$pdf.$delete,"","left",NULL,NULL,NULL,NULL,NULL,NULL);
					echo   gui_td_tag(" ",50); //permet de mettre de l'espace entre chaque collaborateur par ligne
					if($inc!=0  && $iter%3 == 2)   echo   gui_tr_tag_close(); //permet de mettre 3 collaborateurs par ligne
				}
				if($iter!=0  && $iter%3 != 0)   echo   gui_tr_tag_close(); //permet de mettre 3 collaborateurs par ligne et de fermer la ligne
				echo gui_table_tag_close();
			}
			//====================================================================
			// La fonction est appelé en mode de visualisation d'un EAI par le manager car en attente de signature de l'évalué
			elseif($param_statut_eai == self::EAI_STATUS_VALID_MANAGER_FINAL)
			{
				$tab_arg		= array(	':id_user' 	=> $param_id_manager,
											':id_status' => $param_statut_eai
										);
				$data = db_request_select($REQUEST_134,$tab_arg,$this->db_name);
				
				echo    gui_table_tag_open("",5,0,0,NULL,NULL,NULL);
				for($inc=0, $stop=(count($data)-1) ; $inc<$stop; $inc++)
				{
					$iter = $inc ; 
					if($iter%3 == 0) echo gui_tr_tag_open(); //permet de mettre 3 collaborateurs par ligne
					
						echo gui_td_tag($data[$inc][5]." - ".$data[$inc][2]." ".$data[$inc][3],"","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
					
						echo    gui_td_tag_open("","left",NULL,NULL,NULL,NULL,NULL,NULL);
							// option de visualisation car il n'a plus le droit d'y toucher
							echo 	gui_form_post_open("eai_visu_".$inc,$PATH_EAI.$PAGE_0004);
								echo	gui_form_input_hidden_field("operation","eai_visualisation");
								echo	gui_form_input_hidden_field("id_eai",$data[$inc][0]);	
								echo 	gui_jqueryui_li_icon($ICON_VISUALISATION,"onclick=\"javascript: document.eai_visu_".$inc.".submit();\"");
							echo 	gui_form_post_close();
						
						echo    gui_td_tag_close();
	
					echo   gui_td_tag(" ",50); //permet de mettre de l'espace entre chaque collaborateur par ligne
					if($inc!=0  && $iter%3 == 2)   echo   gui_tr_tag_close(); //permet de mettre 3 collaborateurs par ligne
				}
				if($iter!=0  && $iter%3 != 0)   echo   gui_tr_tag_close(); //permet de mettre 3 collaborateurs par ligne et de fermer la ligne
				echo gui_table_tag_close();
			}
			//====================================================================
			// La fonction est appelé en mode de visualisation d'un EAI par le manager car EAI cloturé
			elseif( $param_statut_eai == self::EAI_STATUS_VALID_USER_FINAL )
			{
				$tab_arg		= array(	':id_user' 	=> $param_id_manager,
											':id_status' => $param_statut_eai
										);
				$data = db_request_select($REQUEST_134,$tab_arg,$this->db_name);
				
				echo    gui_table_tag_open("",5,0,0,NULL,NULL,NULL);
				for($inc=0, $stop=(count($data)-1) ; $inc<$stop; $inc++)
				{					
					$iter = $inc ; 
					if($iter%3 == 0) echo gui_tr_tag_open(); //permet de mettre 3 collaborateurs par ligne
					
						echo gui_td_tag($data[$inc][5]." - ".$data[$inc][2]." ".$data[$inc][3],"","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
					
						echo    gui_td_tag_open("","left",NULL,NULL,NULL,NULL,NULL,NULL);
							// option de visualisation car il n'a plus le droit d'y toucher
							echo 	gui_form_post_open("eai_visu_final_".$inc,$PATH_EAI.$PAGE_0004);
								echo	gui_form_input_hidden_field("operation","eai_visualisation");
								echo	gui_form_input_hidden_field("id_eai",$data[$inc][0]);	
								echo 	gui_jqueryui_li_icon($ICON_VISUALISATION,"onclick=\"javascript: document.eai_visu_final_".$inc.".submit();\"");
							echo 	gui_form_post_close();
						
						echo    gui_td_tag_close();
						
						echo    gui_td_tag_open("","left",NULL,NULL,NULL,NULL,NULL,NULL);
						echo 	gui_jqueryui_li_icon($ICON_PDF,"onclick=\"javascript: load_img();
																					document.forms['eai_visu_final_".$inc."'].elements['operation'].value = 'eai_pdf'; 
																					document.eai_visu_final_".$inc.".submit()\"");
				
						echo    gui_td_tag_close();

					echo   gui_td_tag(" ",50); //permet de mettre de l'espace entre chaque collaborateur par ligne
					if($inc !=0   && $iter%3 == 2)   echo   gui_tr_tag_close(); //permet de mettre 3 collaborateurs par ligne
				}
				if($iter!=0  && $iter%3 != 0)   echo   gui_tr_tag_close(); //permet de mettre 3 collaborateurs par ligne et de fermer la ligne
				echo gui_table_tag_close();
			}
			elseif( $param_statut_eai == self::EAI_STATUS_NO_VALID_MANAGER)
			{
				$tab_arg		= array(	':id_user' 	=> $param_id_manager,
											':id_status' => $param_statut_eai
										);
				$data = db_request_select($REQUEST_134,$tab_arg,$this->db_name);
				
				echo    gui_table_tag_open("",5,0,0,NULL,NULL,NULL);
				for($inc=0, $stop=(count($data)-1) ; $inc<$stop; $inc++)
				{
					if($inc==0)
					{
						echo gui_tr_tag_open();
							echo gui_td_tag_open(NULL,NULL,NULL,3);
								echo gui_font_tag("commentaire",$LABEL_0155);
							echo gui_td_tag_close();
						echo gui_tr_tag_close();
					}
					$iter = $inc ; 
					if($iter%3 == 0) echo gui_tr_tag_open(); //permet de mettre 3 collaborateurs par ligne
					
						echo gui_td_tag($data[$inc][5]." - ".$data[$inc][2]." ".$data[$inc][3],"","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
					
						echo    gui_td_tag_open("","left",NULL,NULL,NULL,NULL,NULL,NULL);
							// option de visualisation car il n'a plus le droit d'y toucher
							echo 	gui_form_post_open("eai_visu_final_no_valid_manager_".$inc,$PATH_EAI.$PAGE_0004);
								echo	gui_form_input_hidden_field("operation","eai_visualisation");
								echo	gui_form_input_hidden_field("id_eai",$data[$inc][0]);	
								echo 	gui_jqueryui_li_icon($ICON_VISUALISATION,"onclick=\"javascript: document.eai_visu_final_no_valid_manager_".$inc.".submit();\"");
							echo 	gui_form_post_close();
						
						echo    gui_td_tag_close();
						
						echo    gui_td_tag_open("","left",NULL,NULL,NULL,NULL,NULL,NULL);
						echo 	gui_jqueryui_li_icon($ICON_PDF,"onclick=\"javascript: load_img();
																					document.forms['eai_visu_final_no_valid_manager_".$inc."'].elements['operation'].value = 'eai_pdf'; 
																					document.eai_visu_final_no_valid_manager_".$inc.".submit()\"");
						echo    gui_td_tag_close();
	
					echo   gui_td_tag(" ",50); //permet de mettre de l'espace entre chaque collaborateur par ligne
					if($inc!=0  && $iter%3 == 2)   echo   gui_tr_tag_close(); //permet de mettre 3 collaborateurs par ligne
				}
				if($iter!=0  && $iter%3 != 0)   echo   gui_tr_tag_close(); //permet de mettre 3 collaborateurs par ligne et de fermer la ligne
				echo gui_table_tag_close();
			}
			elseif( $param_statut_eai == self::EAI_STATUS_NO_VALID_USER)
			{
				$tab_arg		= array(	':id_user' 	=> $param_id_manager,
											':id_status' => $param_statut_eai
										);
				$data = db_request_select($REQUEST_134,$tab_arg,$this->db_name);
				
				echo    gui_table_tag_open("",5,0,0,NULL,NULL,NULL);
				for($inc=0, $stop=(count($data)-1) ; $inc<$stop; $inc++)
				{
					if($inc==0)
					{
						echo gui_tr_tag_open();
							echo gui_td_tag_open(NULL,NULL,NULL,3);
							echo gui_font_tag("commentaire",$LABEL_0156);
							echo gui_td_tag_close();
						echo gui_tr_tag_close();
					}
					
					$iter = $inc ; 
					if($iter%3 == 0) echo gui_tr_tag_open(); //permet de mettre 3 collaborateurs par ligne
					
						echo gui_td_tag($data[$inc][5]." - ".$data[$inc][2]." ".$data[$inc][3],"","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
					
						echo    gui_td_tag_open("","left",NULL,NULL,NULL,NULL,NULL,NULL);
							// option de visualisation car il n'a plus le droit d'y toucher
							echo 	gui_form_post_open("eai_visu_final_no_valid_user_".$inc,$PATH_EAI.$PAGE_0004);
								echo	gui_form_input_hidden_field("operation","eai_visualisation");
								echo	gui_form_input_hidden_field("id_eai",$data[$inc][0]);	
								echo 	gui_jqueryui_li_icon($ICON_VISUALISATION,"onclick=\"javascript: document.eai_visu_final_no_valid_user_".$inc.".submit();\"");
							echo 	gui_form_post_close();
						
						echo    gui_td_tag_close();
						
						echo    gui_td_tag_open("","left",NULL,NULL,NULL,NULL,NULL,NULL);
						echo 	gui_jqueryui_li_icon($ICON_PDF,"onclick=\"javascript: load_img();
																					document.forms['eai_visu_final_no_valid_user_".$inc."'].elements['operation'].value = 'eai_pdf'; 
																					document.eai_visu_final_no_valid_user_".$inc.".submit()\"");
						echo    gui_td_tag_close();
	
					echo   gui_td_tag(" ",50); //permet de mettre de l'espace entre chaque collaborateur par ligne
					if($inc!=0  && $iter%3 == 2)   echo   gui_tr_tag_close(); //permet de mettre 3 collaborateurs par ligne
				}
				if($iter!=0  && $iter%3 != 0)   echo   gui_tr_tag_close(); //permet de mettre 3 collaborateurs par ligne et de fermer la ligne
				echo gui_table_tag_close();
			}
			echo	gui_jqueryui_ul_close();
		}
		catch (Exception $e)
		{
			throw new Exception($e->getMessage());
		}
	}
	
        // Create its own EAI
        //============================================================================
        public function create_its_own_eai($param_id_user)
	{
            GLOBAL  $LABEL_0100 ,
                    $REQUEST_057, $REQUEST_109,$REQUEST_177,
                    $ICON_ADD,$ICON_NEW_PDF,$ICON_VISUALISATION,$ICON_UPDATE,$ICON_DELETE,$ICON_PDF,
                    $PATH_EAI,$PAGE_0004,$DISPLAY_UPDATE,$MOVE_NEUTRAL;
                            
            try
            {	
                    $inc = 0;
                    
                    $tab_arg		= array(	':id_user' 	=> $param_id_user);
                    // Récupération de l id du manager
                    $data = db_request_select($REQUEST_057,$tab_arg,$this->db_name);      
                    
                    // Récupération de l'EAI si déjà démarré
                    $tab_arg1		= array(	':id_user' 	=> $param_id_user,
                                                        ':id_manager' 	=>$data[$inc][0],
							':id_status' => self::EAI_STATUS_VALID_MANAGER_TMP
										);
		    $data1 = db_request_select($REQUEST_177,$tab_arg1,$this->db_name);
                    
                    echo    gui_jqueryui_ul_open();	
                    echo    gui_table_tag_open("",5,0,0,NULL,NULL,NULL);
                    echo        gui_tr_tag_open();
                   
                   if( (count($data1)-1) == 0){
                       
                        echo gui_td_tag($data[0][1]." ".$data[0][2],NULL,"left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
                        echo gui_td_tag_open();
                        
                        echo 	gui_form_post_open("eai_creation_own",$PATH_EAI.$PAGE_0004);
                        echo	gui_form_input_hidden_field("operation","eai_creation");
                        echo	gui_form_input_hidden_field("id_manager",$data[$inc][0]);	
                        echo	gui_form_input_hidden_field("id_user",$param_id_user);	
                        echo	gui_form_input_hidden_field("id_stage",1);	//De fait on affiche la première étape de la création de l'EAI
                        
                         $icon =  	gui_jqueryui_li_icon($ICON_ADD,"onclick=\"javascript: document.eai_creation_own.submit();\"");
                         $icon2 =  	gui_jqueryui_li_icon($ICON_NEW_PDF,"onclick=\"javascript: load_img();
                                                                                                                document.forms['eai_creation_own'].elements['operation'].value = 'eai_pdf'; 
                                                                                                                document.eai_creation_own.submit()\"");

                        //================================================
                        //selection d'un modèle
                        //================================================
                        $data_2 = db_request_select($REQUEST_109 , NULL , $this->db_name);
                        $select_data_2 = gui_form_select_field("select_eai_template_creation","select_eai_template_creation",$data_2,"",false,"",0,0) ; 

                        echo    gui_td_tag(" - ".$LABEL_0100,NULL,"left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
                        echo    gui_td_tag($select_data_2,NULL,"left",NULL,NULL,NULL,NULL,NULL,NULL);

                        echo    gui_td_tag($icon,NULL,"left",NULL,NULL,NULL,NULL,NULL,NULL);    
                        echo    gui_td_tag($icon2,NULL,"left",NULL,NULL,NULL,NULL,NULL,NULL);  
                        echo 	gui_form_post_close();
                        echo gui_td_tag_close();
                   }
                   else{
                        echo gui_td_tag_open();
                        echo "</br>";
                        echo gui_td_tag_close();                       
                   }
                   /*
                   else{
                        echo    gui_td_tag($data1[$inc][5]." - ".$data1[$inc][2]." ".$data1[$inc][3],"","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
                        echo gui_td_tag_open();
                        // option de mise à jour
                        echo 	gui_form_post_open("eai_update_own".$inc,$PATH_EAI.$PAGE_0004);

                        echo	gui_form_input_hidden_field("operation","eai_update_stage");
                        echo	gui_form_input_hidden_field("id_eai",$data1[$inc][0]);	
                        echo	gui_form_input_hidden_field("id_stage",1);	//De fait on affiche la première étape (le 2 sera décrémenté en 1 dans eai.php) de la création de l'EAI 
                        echo	gui_form_input_hidden_field("requete",$DISPLAY_UPDATE);
                        echo    gui_form_input_hidden_field("move" ,$MOVE_NEUTRAL);

                       
                        // option mise à jour validé si nous sommes dans une période de campagne valide
                        if($this->check_period_campaign())
                                $icon =  	gui_jqueryui_li_icon($ICON_UPDATE,"onclick=\"javascript: document.eai_update_own".$inc.".submit();\"");
                        else
                                $icon =  	gui_jqueryui_li_icon($ICON_UPDATE,"onclick=\"javascript: $('#dialog_info_campaign').dialog('open');\"");

                        echo 	gui_form_post_close();
                        echo gui_td_tag_close();
                        
                        // option de visualisation
                        echo gui_td_tag_open();
                        echo     gui_form_post_open("eai_visu_tmp_own".$inc,$PATH_EAI.$PAGE_0004);
                        echo    gui_form_input_hidden_field("operation","eai_visualisation");
                        echo    gui_form_input_hidden_field("id_eai",$data1[$inc][0]);   
                        $visu = gui_jqueryui_li_icon($ICON_VISUALISATION,"onclick=\"javascript: document.eai_visu_tmp_own".$inc.".submit();\"");
                        echo     gui_form_post_close();

                         $pdf 	= gui_jqueryui_li_icon($ICON_PDF,"onclick=\"javascript: load_img();
                                                    document.forms['eai_visu_tmp_own".$inc."'].elements['operation'].value = 'eai_pdf'; 
                                                    document.eai_visu_tmp_own".$inc.".submit()\"");
                         echo gui_td_tag_close();
                        // Option de suppresion
                         echo gui_td_tag_open();
                        echo    gui_form_post_open("eai_delete_by_own_".$inc."");

                                echo gui_form_input_hidden_field("operation" ,"eai_delete");
                                echo gui_form_input_hidden_field("select_id_eai" ,$data1[$inc][0]);

                                $delete = gui_jqueryui_li_icon($ICON_DELETE,"onclick=\"javascript: $('#dialog_del_eai_by_manager_".$inc."').dialog('open');\"");
                        echo gui_form_post_close();                        
                        echo gui_td_tag_close();
                        echo    gui_td_tag($icon.$visu.$pdf,"","left",NULL,NULL,NULL,NULL,NULL,NULL);
					
                   }
                   */	
                   
                    echo   gui_tr_tag_close();
                    echo   gui_table_tag_close();
                    echo   gui_jqueryui_ul_close();
            }
            catch (Exception $e)
            {
                    throw new Exception($e->getMessage());
            }
            
        }
	// show_eai_pdf
	//============================================================================
	public function show_eai_pdf($id_eai=NULL,$id_manager=NULL,$id_user=NULL,$id_template=NULL,$id_client_account=NULL)
	{
		try
		{
			GLOBAL $DISPLAY_VISUALISATION, $DISPLAY_BLANK ; 
			GLOBAL $REQUEST_100,$REQUEST_122;
			$display = $DISPLAY_BLANK ; 
			
			// Set le type d'affichage et les nom/prenom/date
			$data = NULL;
			if($id_eai!=NULL)
			{
				$display = $DISPLAY_VISUALISATION; 
				$tab_arg		= array(	':id_eai' 	=> $id_eai	);
				$data = db_request_select($REQUEST_100,$tab_arg,$this->db_name);
			}
			elseif($id_template!=NULL)
			{
				$display = $DISPLAY_BLANK;
				$tab_arg = array(	':id_user' 	=> $id_user	);
				$data = db_request_select($REQUEST_122,$tab_arg,$this->db_name);
			}
			$user_name = $data[0][0];
			$user_fullname = $data[0][0]." ".$data[0][1];
			$year = $data[0][2];

			// Charge et affiche l'EAI dans des buffers
			$objEAI = $this->load_template($id_eai,$id_template,$id_client_account);

			ob_start();
			$objEAI->show_eai($display, $id_eai,NULL,$id_manager,$id_user,$id_template,$id_client_account);
			$html_contents = ob_get_contents();
			ob_end_clean();

			ob_start();
			include('../css/sirh-consulting.css');
			//include('../css/ui/jquery-ui-1.8.21.custom.css');
			include('../css/sirh-consulting_eai_pdf.css');
			$css_contents = ob_get_contents();
			ob_end_clean();

			// Post-process l'HTML généré afin qu'il soit compatible avec html2pdf
			$contents = $this->process_html_for_pdf($html_contents, $css_contents, $user_fullname, $year);
			
                        //echo $contents;
                        
			$html2pdf = new HTML2PDF('L','A4','fr', false, 'ISO-8859-15');
			$html2pdf->WriteHTML($contents);

			$html2pdf->pdf->SetAuthor('SIRH-Consulting');
			$html2pdf->pdf->SetTitle('Entretien Annuel Individuel');
			$html2pdf->pdf->SetSubject('EAI');
			$html2pdf->pdf->SetKeywords("EAI, $user_name");

			$html2pdf->Output();

			$objEAI = NULL;
		}
		catch (Exception $e)
		{
			throw new Exception($e->getMessage());
		}
	}
	
	public function process_html_for_pdf($html, $css, $user_name, $year, $logojpg = "../css/img/logo_sirh.jpg")
	{
		// css
		// FROM : Verdana, Geneva, Arial;
		// TO   : Arial;
		
		$css = str_replace("Verdana,", "", $css);
		$css = str_replace("Geneva,", "", $css);
		$css = str_replace("url(images/ui-bg_glass_55_fbf9ee_1x400.png)", "", $css);
		$css = str_replace("url(images/", "url(../css/ui/images/", $css);
		$css = str_replace(".png", ".jpg", $css);
		
		$html = str_replace("\"section_box\"", "\"section_box_pdf\"", $html);
		
		$header = 
			"<page_header>
				<table style=\"width:100%; border: solid 1px #E7E7E7;\">
					<tr>
						<td style=\"width:50%; text-align:left; font-style:italic; color:#A7A7A7\">
							ENTRETIEN ANNUEL INDIVIDUEL $year - $user_name
						</td>
						<td style=\"width:50%; text-align:right; \">
							<img style=\"height:15; width:15\" src=\"$logojpg\">
						</td>
					</tr>
				</table>
			</page_header>";
		
		$footer = 
			"<page_footer> 
				<div style=\"width:100%; text-align:right; \">
					[[page_cu]]/[[page_nb]]
				</div>
			</page_footer>";
		
		return "<style type=\"text/Css\">
			<!--
			$css
			-->
			</style>
			<page backtop=\"12mm\" backbottom=\"7mm\"> 
			$header
			$footer
			$html
			</page>";
	}

	//============================================================================
	// show_tab_user
	//============================================================================
	public function show_tab_user()
	{
		try
		{
			GLOBAL $LABEL_0067;
			echo 	gui_div_tag_open("tab_eai_user"); 
				echo 	gui_div_tag_open("accordion_eai_user"); 
					
					echo 	gui_div_tag_open(); 
						echo "<h3><a href=\"#\">".$LABEL_0067."</a></h3>";
						echo 	gui_div_tag_open(); 
						
						$this->show_user_data($this->id_user);
						
						echo 	gui_div_tag_close();
					echo 	gui_div_tag_close();
				
				echo 	gui_div_tag_close();		
			echo 	gui_div_tag_close();
		}
		catch (Exception $e)
		{
			throw new Exception($e->getMessage());
		}
	}
	//============================================================================
	// show_tab_manager
	//============================================================================
	public function show_tab_manager($id_manager)
	{
		try
		{
			GLOBAL  $LABEL_0067,$LABEL_0187,$LABEL_0188,$LABEL_0189,$LABEL_0190,$LABEL_0191,$LABEL_0192;
			
			echo 	gui_div_tag_open("tab_eai_manager"); 
				echo 	gui_div_tag_open("accordion_eai_manager"); 
					
					echo 	gui_div_tag_open(); 
						//========================================================
						//Suivi des entretiens
						echo "<h3><a href=\"#\">".$LABEL_0067."</a></h3>";
						echo 	gui_div_tag_open(); 
						
						/**********************/
						
						$this->show_manager_data($id_manager);
						
						/**********************/
						
						echo 	gui_div_tag_close();
					echo 	gui_div_tag_close();
					
					echo 	gui_div_tag_open(); 
						//========================================================
						// Tableau de bord des compétences
						echo "<h3><a href=\"#\">".$LABEL_0187."</a></h3>";
						echo 	gui_div_tag_open(); 
						
						/**********************/
						
						$this->show_dashboard_competence(PROFILE_MANAGER);
						
						/**********************/
						
						echo 	gui_div_tag_close();
					echo 	gui_div_tag_close();
					
					echo 	gui_div_tag_open(); 
						//========================================================
						// Tableau de bord des évaluations globales
						echo "<h3><a href=\"#\">".$LABEL_0189."</a></h3>";
						echo 	gui_div_tag_open(); 
						
						/**********************/
						
						$this->show_dashboard_evaluation_trend(PROFILE_MANAGER); 
						
						/**********************/
						
						echo 	gui_div_tag_close();
					echo 	gui_div_tag_close();
					
					echo 	gui_div_tag_open(); 
						//========================================================
						// Tableau de bord des formations
						echo "<h3><a href=\"#\">".$LABEL_0191."</a></h3>";
						echo 	gui_div_tag_open(); 
						
						/**********************/
						
						$this->show_dashboard_training(PROFILE_MANAGER); 
						
						/**********************/
						
						echo 	gui_div_tag_close();
					echo 	gui_div_tag_close();
					
					echo 	gui_div_tag_open(); 
						//========================================================
						// Tableau de bord des objectifs de l'année écoulée
						echo "<h3><a href=\"#\">".$LABEL_0188."</a></h3>";
						echo 	gui_div_tag_open(); 
						
						/**********************/
						
						$this->show_dashboard_previous_objectives(PROFILE_MANAGER); 
						
						/**********************/
						
						echo 	gui_div_tag_close();
					echo 	gui_div_tag_close();
					
					echo 	gui_div_tag_open(); 
						//========================================================
						// Tableau de bord des objectifs futurs
						echo "<h3><a href=\"#\">".$LABEL_0190."</a></h3>";
						echo 	gui_div_tag_open(); 
						
						/**********************/
						
						$this->show_dashboard_futur_objectives(PROFILE_MANAGER); 
						
						/**********************/
						
						echo 	gui_div_tag_close();
					echo 	gui_div_tag_close();
					
					echo 	gui_div_tag_open(); 
						//========================================================
						// Tableau de bord bien-être et satisfaction
						echo "<h3><a href=\"#\">".$LABEL_0192."</a></h3>";
						echo 	gui_div_tag_open(); 
						
						/**********************/
						
						$this->show_dashboard_satisfaction(PROFILE_MANAGER); 
						
						/**********************/
						
						echo 	gui_div_tag_close();
					echo 	gui_div_tag_close();
					
				echo 	gui_div_tag_close();		
			echo 	gui_div_tag_close();
		}
		catch (Exception $e)
		{
			throw new Exception($e->getMessage());
		}
	}
	//============================================================================
	// show_graph_parameters
	//============================================================================
	public function show_graph_parameters($type_graph,$type_profil=0,$dataManager=NULL) /*,$id_criterion=0*/
	{
		try
		{
			GLOBAL  $GRAPH_COMPETENCES,$GRAPH_EVALUATION,$GRAPH_TREND,$GRAPH_TRAINING,$GRAPH_PREVIOUS_OBJ,$GRAPH_FUTUR_OBJ,$GRAPH_SATISFACTION,
					$MESSAGE_0042,$ICON_REFRESH,
					$LABEL_0068,$LABEL_0164,$LABEL_0071;
					
			$prefixe_year   = "year_" ; 
			$prefixe_node   = "node_" ; 
			$prefixe_manager= "manager_" ; 
			
			switch($type_graph){
				case $GRAPH_COMPETENCES:
					$prefixe_year.= $type_profil."_" ; 
					$prefixe_node.= $type_profil."_" ; 
					$prefixe_manager.= $type_profil."_" ; 
					break;
				case $GRAPH_EVALUATION:
					$prefixe_year.= "eval_".$type_profil."_" ; 
					$prefixe_node.= "eval_".$type_profil."_" ; 
					$prefixe_manager.= "eval_".$type_profil."_" ; 
					break;
				case $GRAPH_TRAINING:
					$prefixe_year.= "training_".$type_profil."_" ; 
					$prefixe_node.= "training_".$type_profil."_" ; 
					$prefixe_manager.= "training_".$type_profil."_" ; 
					break;
				//case $GRAPH_TREND:
				//	$prefixe_year.= "trend_".$type_profil."_" ; 
				//	$prefixe_node.= "trend_".$type_profil."_" ; 
				//	$prefixe_manager.= "trend_".$type_profil."_" ; 
				//	break;
				case $GRAPH_PREVIOUS_OBJ:
					$prefixe_year.= "p_obj_".$type_profil."_" ; 
					$prefixe_node.= "p_obj_".$type_profil."_" ; 
					$prefixe_manager.= "p_obj_".$type_profil."_" ; 
					break;
				case $GRAPH_FUTUR_OBJ:
					$prefixe_year.= "f_obj_".$type_profil."_" ; 
					$prefixe_node.= "f_obj_".$type_profil."_" ; 
					$prefixe_manager.= "f_obj_".$type_profil."_" ; 
					break;
				case $GRAPH_SATISFACTION:
					$prefixe_year.= "satisfaction_".$type_profil."_";//.$id_criterion."_";
					$prefixe_node.= "satisfaction_".$type_profil."_";//.$id_criterion."_";
					$prefixe_manager.= "satisfaction_".$type_profil."_";//.$id_criterion."_";
					break;
			}
			echo gui_form_post_open("form_non_actif_pour_ajax_0","","") ;
			
			echo    gui_table_tag_open("100%",0,5,0,NULL,NULL,NULL) ; 
				
			if($this->years != NULL && $this->years[0][0] != NULL)
			{
				echo    gui_tr_tag_open(NULL,NULL,NULL,NULL,NULL) ; 
					echo    gui_td_tag_open("","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
						echo    gui_info_message("".$MESSAGE_0042);
					echo    gui_td_tag_close() ; 
				echo    gui_tr_tag_close() ;
				
				echo    gui_tr_tag_open(NULL,NULL,NULL,NULL,NULL) ; 
                    echo    gui_th_tag($LABEL_0164,"","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
                echo    gui_tr_tag_close() ;
				
				for($data_count=0, $stop=(count($this->years)-1); $data_count<$stop;$data_count++)
				{
					echo    gui_tr_tag_open(NULL,NULL,NULL,NULL,NULL) ; 
						echo    gui_td_tag_open("","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
							echo gui_form_input_check_field($prefixe_year.$data_count,$this->years[$data_count][0],$prefixe_year.$data_count,false,false,false);
							echo "  <label for=\"".$prefixe_year.$data_count."\">".$this->years[$data_count][0]."</label><br/>";
						echo    gui_td_tag_close() ; 
					echo    gui_tr_tag_close() ; 
				}
			}
			if($type_profil == PROFILE_MANAGER)
			{
				if($this->tab_node_user != NULL && $this->tab_node_user[0][0] != NULL)
				{
					echo    gui_tr_tag_open(NULL,NULL,NULL,NULL,NULL) ; 
	                    echo    gui_th_tag($LABEL_0068,"","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
	                echo    gui_tr_tag_close() ;
	                
					for($data_count=0, $stop=(count($this->tab_node_user)); $data_count<$stop;$data_count++)
					{
						echo    gui_tr_tag_open(NULL,NULL,NULL,NULL,NULL) ; 
							echo    gui_td_tag_open("","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
								echo gui_form_input_check_field($prefixe_node.$data_count,$this->tab_node_user[$data_count][0],$prefixe_node.$data_count,false,false,false);
								echo "  <label for=\"".$prefixe_node.$data_count."\">".$this->tab_node_user[$data_count][1]."</label><br/>";
							echo    gui_td_tag_close() ; 
						echo    gui_tr_tag_close() ; 
					}
				}
			}
			elseif($type_profil == PROFILE_EXPERT_RH && $this->listNode != NULL)
			{
				echo    gui_tr_tag_open(NULL,NULL,NULL,NULL,NULL) ; 
                    echo    gui_th_tag($LABEL_0068,"","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
                echo    gui_tr_tag_close() ;
                
				for($data_count=0, $stop=(count($this->listNode)-1) ; $data_count < $stop; $data_count++)
				{
					echo    gui_tr_tag_open(NULL,NULL,NULL,NULL,NULL) ; 
						echo    gui_td_tag_open("","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
							echo gui_form_input_check_field($prefixe_node.$data_count,$this->listNode[$data_count][0],$prefixe_node.$data_count,false,false,false);
							echo "  <label for=\"".$prefixe_node.$data_count."\">".$this->listNode[$data_count][1]."</label><br/>";
						echo    gui_td_tag_close() ; 
					echo    gui_tr_tag_close() ; 
				}
			}
			
			if($type_profil == PROFILE_MANAGER)
			{
				if($this->tab_manager_under_user != NULL && $this->tab_manager_under_user[0][0] != NULL)
				{
					echo    gui_tr_tag_open(NULL,NULL,NULL,NULL,NULL) ; 
	                    echo    gui_th_tag($LABEL_0071,"","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
	                echo    gui_tr_tag_close() ;
	                
					for($data_count=0, $stop=(count($this->tab_manager_under_user)); $data_count<$stop;$data_count++)
					{
						echo    gui_tr_tag_open(NULL,NULL,NULL,NULL,NULL) ; 
							echo    gui_td_tag_open("","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
								echo gui_form_input_check_field($prefixe_manager.$data_count,$this->tab_manager_under_user[$data_count][0],$prefixe_manager.$data_count,false,false,false);
								echo "  <label for=\"".$prefixe_manager.$data_count."\">".$this->tab_manager_under_user[$data_count][2]." ".$this->tab_manager_under_user[$data_count][1]."</label><br/>";
							echo    gui_td_tag_close() ; 
						echo    gui_tr_tag_close() ; 
					}
				}
			}
			elseif($type_profil == PROFILE_EXPERT_RH && $this->listManager != NULL)
			{
				echo    gui_tr_tag_open(NULL,NULL,NULL,NULL,NULL) ; 
                    echo    gui_th_tag($LABEL_0071,"","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
                echo    gui_tr_tag_close() ;
                
				for($data_count=0, $stop=(count($this->listManager)-1) ; $data_count < $stop; $data_count++)
				{
					echo    gui_tr_tag_open(NULL,NULL,NULL,NULL,NULL) ; 
						echo    gui_td_tag_open("","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
							echo gui_form_input_check_field($prefixe_manager.$data_count,$this->listManager[$data_count][0],$prefixe_manager.$data_count,false,false,false);
							echo "  <label for=\"".$prefixe_manager.$data_count."\">".$this->listManager[$data_count][2]." ".$this->listManager[$data_count][1]."</label><br/>";
						echo    gui_td_tag_close() ; 
					echo    gui_tr_tag_close() ; 
				}
			}
				echo    gui_tr_tag_open(NULL,NULL,NULL,NULL,NULL) ; 
					echo    gui_td_tag_open("","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
						echo gui_jqueryui_ul_open();
							switch($type_graph){
								case $GRAPH_COMPETENCES:
									echo gui_jqueryui_li_icon($ICON_REFRESH, "onclick=\"load_img(); ajax_function('ajax_refresh_graph_competences',".$type_profil.");\"") ; 
									break;
								case $GRAPH_EVALUATION:
									echo gui_jqueryui_li_icon($ICON_REFRESH, "onclick=\"load_img(); ajax_function('ajax_refresh_graph_evaluation',".$type_profil.");\"") ; 
									break;
								case $GRAPH_TRAINING:
									echo gui_jqueryui_li_icon($ICON_REFRESH, "onclick=\"load_img(); ajax_function('ajax_refresh_graph_training',".$type_profil.");\"") ; 
									break;
								//case $GRAPH_TREND:
								//	echo gui_jqueryui_li_icon($ICON_REFRESH, "onclick=\"load_img(); ajax_function('ajax_refresh_graph_trend',".$type_profil.");\"") ; 
								//	break;
								case $GRAPH_PREVIOUS_OBJ:
									echo gui_jqueryui_li_icon($ICON_REFRESH, "onclick=\"load_img(); ajax_function('ajax_refresh_graph_previous_obj',".$type_profil.");\"") ; 
									break;
								case $GRAPH_FUTUR_OBJ:
									echo gui_jqueryui_li_icon($ICON_REFRESH, "onclick=\"load_img(); ajax_function('ajax_refresh_graph_futur_obj',".$type_profil.");\"") ; 
									break;
								case $GRAPH_SATISFACTION:
									echo gui_jqueryui_li_icon($ICON_REFRESH, "onclick=\"load_img(); ajax_function('ajax_refresh_graph_satisfaction',".$type_profil.");\"") ; //,".$id_criterion."
									break;
							}
						echo gui_jqueryui_ul_close();
					echo    gui_td_tag_close() ; 
				echo    gui_tr_tag_close() ; 
			
			echo    gui_table_tag_close() ; 
			echo gui_form_post_close() ; 
		}
		catch (Exception $e)
		{
			throw new Exception($e->getMessage());
		}
	}
	//============================================================================
	// show_dashboard_competence
	//============================================================================
	public function show_dashboard_competence($type_profil)
	{
		try
		{
			GLOBAL  $LABEL_0159,$LABEL_0160,$LABEL_0161,
					$GRAPH_COMPETENCES;

			//========================================================================
			// Tableau de bord des compétences
			echo    gui_table_tag_open("100%",0,0,0,NULL,NULL,NULL) ; 

				echo    gui_tr_tag_open() ; 
					echo    gui_td_tag_open("100%",NULL,NULL,2,NULL,"td_data_bold",NULL,NULL) ; 
						//=========================================
						// A.   Analyses des compétences
						echo gui_font_tag("titre_1",$LABEL_0159);
					echo    gui_td_tag_close() ; 
				echo    gui_tr_tag_close() ; 
				echo    gui_tr_tag_empty(1,2) ; 
				echo    gui_tr_tag_open() ; 
					echo    gui_td_tag_open("100%","center",NULL,2,NULL,NULL,NULL,NULL) ; 
						//=========================================
						// 1.   Graphique des compétences
						echo gui_font_tag("titre_2_ssligne",$LABEL_0160);
					echo    gui_td_tag_close() ; 
				echo    gui_tr_tag_close() ; 
				echo    gui_tr_tag_empty(1,2) ; 
				echo    gui_tr_tag_open() ; 
					echo    gui_td_tag_open("","left","top",NULL,NULL,NULL,NULL,NULL) ; 
					
						$this->show_graph_parameters($GRAPH_COMPETENCES, $type_profil) ; 
					
					echo    gui_td_tag_close() ; 
					
					echo    gui_td_tag_open("","center",NULL,NULL,NULL,NULL,NULL,NULL) ; 		
					
						$tmp2[0]    = $this->id_user ; 
						$tab_data_1 = $this->get_stat_competence($this->last_year,$type_profil, NULL,$tmp2) ; 
						$name_img_radar = "";
						
						if($tab_data_1 != NULL && $tab_data_1[0][0] != NULL)
						{
							$tab_data[0] = $tab_data_1 ; 	
							$name_img_radar = draw_radar($this->id_user,$tab_data) ; //tableau à plusieurs dimensions pour prévoir la supperposition des années
						}
						echo gui_img_tag($name_img_radar,$LABEL_0160,NULL,NULL,NULL,"graphique_competences_".$type_profil,NULL) ; 
						
					echo    gui_td_tag_close() ; 
				echo    gui_tr_tag_close() ; 
				echo    gui_tr_tag_open() ; 
					echo    gui_td_tag_open("100%","center",NULL,2,NULL,NULL,NULL,NULL) ; 
						//=========================================
						// 2.   Revue des compétences
						echo gui_font_tag("titre_2_ssligne",$LABEL_0161);
					echo    gui_td_tag_close() ; 
				 echo    gui_tr_tag_close() ;
				 echo    gui_tr_tag_empty(1,2) ; 
				 echo    gui_tr_tag_open() ; 
					echo    gui_td_tag_open("100%","center",NULL,2,NULL,NULL,NULL,NULL) ; 
						echo gui_div_tag_open("refresh_table_competence_per_manager_".$type_profil); 
							$tmp[0]     = $this->last_year ; 
							echo    $this->show_table_competence($tmp,$type_profil,NULL,$tmp2);
						echo gui_div_tag_close();
					echo    gui_td_tag_close() ; 
				 echo    gui_tr_tag_close() ;
				 echo    gui_tr_tag_empty(1,1) ;  
			echo    gui_table_tag_close() ; 
		}
		catch (Exception $e)
		{
			throw new Exception($e->getMessage());
		}
	}
	//============================================================================
	// show_dashboard_evaluation_trend
	//============================================================================
	public function show_dashboard_evaluation_trend($type_profil)
	{
		try
		{
			GLOBAL  $LABEL_0165,$LABEL_0166,$LABEL_0168,$LABEL_0173,$LABEL_0174,
					$GRAPH_EVALUATION,$GRAPH_TREND;
					
			//========================================================================
			// Tableau de bord des évaluations globales
			echo    gui_table_tag_open("100%",0,0,0,NULL,NULL,NULL) ; 
				echo    gui_tr_tag_open() ; 
					echo    gui_td_tag_open("100%",NULL,NULL,2,NULL,"td_data_bold",NULL,NULL) ; 
						//=========================================
						// B.   Analyse des évaluations globales
						echo gui_font_tag("titre_1",$LABEL_0165);
					echo    gui_td_tag_close() ; 
				echo    gui_tr_tag_close() ; 
				echo    gui_tr_tag_empty(1,2) ; 
				echo    gui_tr_tag_open() ; 
					echo    gui_td_tag_open("100%","center",NULL,2,NULL,NULL,NULL,NULL) ; 
						//=========================================
						// 1.   Graphique des évaluations globales et graphique des tendances
						echo gui_font_tag("titre_2_ssligne",$LABEL_0166);
					echo    gui_td_tag_close() ; 
				echo    gui_tr_tag_close() ; 
				echo    gui_tr_tag_empty(1,2) ; 
				echo    gui_tr_tag_open() ; 
					echo    gui_td_tag_open("","left","top",NULL,4,NULL,NULL,NULL) ; 
					
						$this->show_graph_parameters($GRAPH_EVALUATION , $type_profil) ; 
					
					echo    gui_td_tag_close() ; 
					
					echo    gui_td_tag_open("","center",NULL,NULL,NULL,NULL,NULL,NULL) ; 	
					
						$tmp2[0]    = $this->id_user ; 
						$tab_data_1 = $this->get_stat_eval($this->last_year,$type_profil,NULL,$tmp2) ; 
						$name_img_bar_1 = "";
						if($tab_data_1 != NULL && $tab_data_1[0][0] != NULL)
						{
							$tab_data1[0] = $tab_data_1 ; 
							$name_img_bar_1 = draw_bars($this->id_user,$tab_data1,$LABEL_0174) ; 
						}
						echo gui_img_tag($name_img_bar_1,NULL,NULL,NULL,NULL,"graphique_evaluation_".$type_profil,NULL) ; 
						
					echo    gui_td_tag_close() ; 
				echo    gui_tr_tag_close() ; 
				echo    gui_tr_tag_empty(2,2) ; 
				echo    gui_tr_tag_open() ; 
					echo    gui_td_tag_open("","center",NULL,NULL,NULL,NULL,NULL,NULL) ;
						
						$tab_data_2 = $this->get_stat_trend($this->last_year,$type_profil) ; 
						$name_img_bar = "";
						if($tab_data_2 != NULL && $tab_data_2[0][0] != NULL)
						{
							$tab_data2[0] = $tab_data_2 ; 
							$name_img_bar = draw_bars($this->id_user,$tab_data2,$LABEL_0173) ; 
						}
						echo gui_img_tag($name_img_bar,NULL,NULL,NULL,NULL,"graphique_trend_".$type_profil,NULL) ; 
						
					echo    gui_td_tag_close() ; 
				echo    gui_tr_tag_close() ; 
				echo    gui_tr_tag_empty(1,2) ; 
				echo    gui_tr_tag_open() ; 
					echo    gui_td_tag_open("100%","center",NULL,2,NULL,NULL,NULL,NULL) ; 
						//=========================================
						// 2.   Revue des évaluations globales et des tendances
						echo gui_font_tag("titre_2_ssligne",$LABEL_0168);
					echo    gui_td_tag_close() ; 
				 echo    gui_tr_tag_close() ;
				echo    gui_tr_tag_empty(1,2) ;  
				echo    gui_tr_tag_open() ; 
					echo    gui_td_tag_open("100%","center",NULL,2,NULL,NULL,NULL,NULL) ; 
						echo gui_div_tag_open("refresh_table_trend_per_manager_".$type_profil); 
							$tmp[0] = $this->last_year ; 
							echo    $this->get_table_trend($tmp,$type_profil,NULL,$tmp2);
						echo gui_div_tag_close(); 
					echo    gui_td_tag_close() ; 
				 echo    gui_tr_tag_close() ;
				 echo    gui_tr_tag_empty(1,2) ;  
			echo    gui_table_tag_close() ; 	
		}
		catch (Exception $e)
		{
			throw new Exception($e->getMessage());
		}
	}
	//============================================================================
	// show_dashboard_training
	//============================================================================
	public function show_dashboard_training($type_profil)
	{
		try
		{
			 GLOBAL $LABEL_0193,$LABEL_0194,$LABEL_0195,$LABEL_0196,$LABEL_0197,$LABEL_0198,
					$GRAPH_TRAINING ;
					
			$tmp[0] = $this->last_year ; 
			//========================================================================
			// Tableau de bord des formations
			echo    gui_table_tag_open("100%",0,0,0,NULL,NULL,NULL) ; 
				echo    gui_tr_tag_open() ; 
					echo    gui_td_tag_open("100%",NULL,NULL,2,NULL,"td_data_bold",NULL,NULL) ; 
						//=========================================
						// Analyse des formations
						echo gui_font_tag("titre_1",$LABEL_0193);
					echo    gui_td_tag_close() ; 
				echo    gui_tr_tag_close() ; 
				echo    gui_tr_tag_empty(1,2) ; 
				echo    gui_tr_tag_open() ; 
					echo    gui_td_tag_open("100%","center",NULL,2,NULL,NULL,NULL,NULL) ; 
						//=========================================
						// Graphique des formations suivies et graphique des formations demandées
						echo gui_font_tag("titre_2_ssligne",$LABEL_0194);
					echo    gui_td_tag_close() ; 
				echo    gui_tr_tag_close() ; 
				echo    gui_tr_tag_empty(1,2) ; 
				echo    gui_tr_tag_open() ; 
					echo    gui_td_tag_open("","left","top",NULL,4,NULL,NULL,NULL) ; 
					
						$this->show_graph_parameters($GRAPH_TRAINING , $type_profil) ; 
					
					echo    gui_td_tag_close() ; 
					
					echo    gui_td_tag_open("","center",NULL,NULL,NULL,NULL,NULL,NULL) ; 	
						
						$tmp2[0]    = $this->id_user ; 
						$tab_data_1 = $this->get_stat_training_followed($this->last_year,$type_profil,NULL,$tmp2) ; 
						$name_img_bar_1 = "" ; 
						if($tab_data_1 != NULL && $tab_data_1[0][0] != NULL)
						{
							$tab_data1[0] = $tab_data_1 ; 
							$name_img_bar_1 = draw_bars($this->id_user,$tab_data1,$LABEL_0195,1) ; 	
						}
						echo gui_img_tag($name_img_bar_1,NULL,NULL,NULL,NULL,"graphique_training_followed_".$type_profil,NULL) ; 
						
					echo    gui_td_tag_close() ; 
				echo    gui_tr_tag_close() ; 
				echo    gui_tr_tag_empty(2,2) ; 
				echo    gui_tr_tag_open() ; 
					echo    gui_td_tag_open("","center",NULL,NULL,NULL,NULL,NULL,NULL) ;
					
						$tab_data_2 = $this->get_stat_training_forecasted($this->last_year,$type_profil,NULL,$tmp2) ; 
						$name_img_bar = "" ;
						if($tab_data_2 != NULL && $tab_data_2[0][0] != NULL)
						{
							$tab_data2[0] = $tab_data_2 ; 
							$name_img_bar = draw_bars($this->id_user,$tab_data2,$LABEL_0196,1) ; 
						}
						echo gui_img_tag($name_img_bar,NULL,NULL,NULL,NULL,"graphique_training_forecasted_".$type_profil,NULL) ; 
						
					echo    gui_td_tag_close() ; 
				echo    gui_tr_tag_close() ; 
				echo    gui_tr_tag_empty(1,2) ; 
				echo    gui_tr_tag_open() ; 
					echo    gui_td_tag_open("100%","center",NULL,2,NULL,NULL,NULL,NULL) ; 
						//=========================================
						// Revue des formations suivies
						echo gui_font_tag("titre_2_ssligne",$LABEL_0197);
					echo    gui_td_tag_close() ; 
				 echo    gui_tr_tag_close() ;
				echo    gui_tr_tag_empty(1,2) ;  
				echo    gui_tr_tag_open() ; 
					echo    gui_td_tag_open("100%","center",NULL,2,NULL,NULL,NULL,NULL) ; 
						echo gui_div_tag_open("refresh_table_training_followed_".$type_profil); 
							
							echo    $this->get_table_training_followed($tmp,$type_profil,NULL,$tmp2);
							
						echo gui_div_tag_close(); 
					echo    gui_td_tag_close() ; 
				echo    gui_tr_tag_close() ;
				echo    gui_tr_tag_empty(1,2) ;  
				echo    gui_tr_tag_open() ; 
					echo    gui_td_tag_open("100%","center",NULL,2,NULL,NULL,NULL,NULL) ; 
						//=========================================
						// Revue des formations envisagées
						echo gui_font_tag("titre_2_ssligne",$LABEL_0198);
					echo    gui_td_tag_close() ; 
				 echo    gui_tr_tag_close() ;
				echo    gui_tr_tag_empty(1,2) ;  
				echo    gui_tr_tag_open() ; 
					echo    gui_td_tag_open("100%","center",NULL,2,NULL,NULL,NULL,NULL) ; 
						echo gui_div_tag_open("refresh_table_training_forecasted_".$type_profil); 
							
							echo    $this->get_table_training_forecasted($tmp,$type_profil,NULL,$tmp2);
							
						echo gui_div_tag_close(); 
					echo    gui_td_tag_close() ; 
				 echo    gui_tr_tag_close() ;
				 echo    gui_tr_tag_empty(1,2) ;  
			echo    gui_table_tag_close() ; 	
		}
		catch (Exception $e)
		{
			throw new Exception($e->getMessage());
		}
	}
	//============================================================================
	// show_dashboard_previous_objectives
	//============================================================================
	public function show_dashboard_previous_objectives($type_profil)
	{
		try
		{
			GLOBAL  $LABEL_0169,$LABEL_0170,$LABEL_0171,$LABEL_0186,
					$GRAPH_PREVIOUS_OBJ;

			//========================================================================
			// Tableau de bord des objectifs de l'année écoulée
			echo    gui_table_tag_open("100%",0,0,0,NULL,NULL,NULL) ; 
				echo    gui_tr_tag_open() ; 
					echo    gui_td_tag_open("100%",NULL,NULL,2,NULL,"td_data_bold",NULL,NULL) ; 
						//=========================================
						// C.   Analyse des objectifs de l'année écoulée
						echo gui_font_tag("titre_1",$LABEL_0169);
					echo    gui_td_tag_close() ; 
				echo    gui_tr_tag_close() ; 
				echo    gui_tr_tag_empty(1,2) ; 
				echo    gui_tr_tag_open() ; 
					echo    gui_td_tag_open("100%","center",NULL,2,NULL,NULL,NULL,NULL) ; 
						//=========================================
						// 1.   Graphique des objectifs de l'année écoulée
						echo gui_font_tag("titre_2_ssligne",$LABEL_0170);
					echo    gui_td_tag_close() ; 
				echo    gui_tr_tag_close() ; 
				echo    gui_tr_tag_empty(1,2) ; 
				echo    gui_tr_tag_open() ; 
					echo    gui_td_tag_open("","left","top",NULL,NULL,NULL,NULL,NULL) ; 
					
						$this->show_graph_parameters($GRAPH_PREVIOUS_OBJ , $type_profil) ; 
					
					echo    gui_td_tag_close() ; 
					echo    gui_td_tag_open("","center",NULL,NULL,NULL,NULL,NULL,NULL) ;
					
						$tmp2[0]= $this->id_user ; 
						$tab_data_3 = $this->get_stat_previous_objectives($this->last_year,$type_profil,NULL,$tmp2) ; 
						$name_img_bar = "";
						if($tab_data_3 != NULL && $tab_data_3[0][0] != NULL)
						{
							$tab_data3[0] = $tab_data_3 ; 
							$name_img_bar = draw_bars($this->id_user,$tab_data3,$LABEL_0186) ; 
						}
						echo gui_img_tag($name_img_bar,NULL,NULL,NULL,NULL,"graphique_p_obj_".$type_profil,NULL) ; 
						
					echo    gui_td_tag_close() ; 
				echo    gui_tr_tag_close() ; 
				echo    gui_tr_tag_empty(1,2) ; 
				echo    gui_tr_tag_open() ; 
					echo    gui_td_tag_open("100%","center",NULL,2,NULL,NULL,NULL,NULL) ; 
						//=========================================
						// 2.   Revue des objectifs de l'année écoulée
						echo gui_font_tag("titre_2_ssligne",$LABEL_0171);
					echo    gui_td_tag_close() ; 
				 echo    gui_tr_tag_close() ;
				echo    gui_tr_tag_empty(1,2) ;  
				echo    gui_tr_tag_open() ; 
					echo    gui_td_tag_open("100%","center",NULL,2,NULL,NULL,NULL,NULL) ; 
						echo gui_div_tag_open("refresh_table_graphique_p_obj_per_manager_".$type_profil); 
							$tmp[0] = $this->last_year ; 
							echo    $this->get_table_previous_objectives($tmp,$type_profil,NULL,$tmp2);
						echo gui_div_tag_close(); 
					echo    gui_td_tag_close() ; 
				 echo    gui_tr_tag_close() ;
				 echo    gui_tr_tag_empty(1,2) ;  
			echo    gui_table_tag_close() ; 
		}
		catch (Exception $e)
		{
			throw new Exception($e->getMessage());
		}
	}
	//============================================================================
	// show_dashboard_futur_objectives
	//============================================================================
	public function show_dashboard_futur_objectives($type_profil)
	{
		try
		{
			GLOBAL  $LABEL_0176,$LABEL_0177,$LABEL_0178,$LABEL_0179,
					$GRAPH_FUTUR_OBJ;

			//========================================================================
			// Tableau de bord des objectifs futurs
			echo    gui_table_tag_open("100%",0,0,0,NULL,NULL,NULL) ; 
				echo    gui_tr_tag_open() ; 
					echo    gui_td_tag_open("100%",NULL,NULL,2,NULL,"td_data_bold",NULL,NULL) ; 
						//=========================================
						// D.   Suivi des objectifs futurs
						echo gui_font_tag("titre_1",$LABEL_0176);
					echo    gui_td_tag_close() ; 
				echo    gui_tr_tag_close() ; 
				echo    gui_tr_tag_empty(1,2) ; 
				echo    gui_tr_tag_open() ; 
					echo    gui_td_tag_open("100%","center",NULL,2,NULL,NULL,NULL,NULL) ; 
						//=========================================
						// 1.   Graphique des objectifs futurs
						echo gui_font_tag("titre_2_ssligne",$LABEL_0177);
					echo    gui_td_tag_close() ; 
				echo    gui_tr_tag_close() ; 
				echo    gui_tr_tag_empty(1,2) ; 
				echo    gui_tr_tag_open() ; 
					echo    gui_td_tag_open("","left","top",NULL,NULL,NULL,NULL,NULL) ; 
					
						$this->show_graph_parameters($GRAPH_FUTUR_OBJ , $type_profil) ; 
					
					echo    gui_td_tag_close() ; 
					echo    gui_td_tag_open("","center",NULL,NULL,NULL,NULL,NULL,NULL) ;
					
						$tmp2[0]= $this->id_user ; 
						$tab_data_4 = $this->get_stat_futur_objectives($this->last_year,$type_profil,NULL,$tmp2) ; 
						$name_img_bar = "";
						if($tab_data_4 != NULL && $tab_data_4[0][0] != NULL)
						{
							$tab_data4[0] = $tab_data_4 ; 
							$name_img_bar = draw_bars($this->id_user,$tab_data4,$LABEL_0179) ; 
						}
						echo gui_img_tag($name_img_bar,NULL,NULL,NULL,NULL,"graphique_f_obj_".$type_profil,NULL) ; 
						
					echo    gui_td_tag_close() ; 
				echo    gui_tr_tag_close() ; 
				echo    gui_tr_tag_empty(1,2) ; 
				echo    gui_tr_tag_open() ; 
					echo    gui_td_tag_open("100%","center",NULL,2,NULL,NULL,NULL,NULL) ; 
						//=========================================
						// 2.   Revue des objectifs futurs
						echo gui_font_tag("titre_2_ssligne",$LABEL_0178);
					echo    gui_td_tag_close() ; 
				 echo    gui_tr_tag_close() ;
				echo    gui_tr_tag_empty(1,2) ;  
				echo    gui_tr_tag_open() ; 
					echo    gui_td_tag_open("100%","center",NULL,2,NULL,NULL,NULL,NULL) ; 
						echo gui_div_tag_open("refresh_table_graphique_f_obj_per_manager_".$type_profil); 
							$tmp[0] = $this->last_year ; 
							echo $this->get_table_futur_objectives($tmp,$type_profil,NULL,$tmp2);
						echo gui_div_tag_close(); 
					echo    gui_td_tag_close() ; 
				 echo    gui_tr_tag_close() ;
				 echo    gui_tr_tag_empty(1,2) ;  
			echo    gui_table_tag_close() ; 
		}
		catch (Exception $e)
		{
			throw new Exception($e->getMessage());
		}
	}
	//============================================================================
	// show_dashboard_satisfaction
	//============================================================================
	public function show_dashboard_satisfaction($type_profil)
	{
		try
		{
			GLOBAL  $LABEL_0180,$LABEL_0181,$LABEL_0182,
					$GRAPH_SATISFACTION,
					$REQUEST_210,$REQUEST_212;					

            $tmp2[0]= $this->id_user ; 
            $tab_arg = array(':annee' => $this->last_year, ':id_manager' => $this->id_user);
			$tab_stat = db_request_select($REQUEST_210 , $tab_arg , $this->db_name);
			$tab_stat_all = db_request_select($REQUEST_212 , NULL , $this->db_name);
			//========================================================================
			// Tableau de bord bien-être et satisfaction
			echo    gui_table_tag_open("100%",0,0,0,NULL,NULL,NULL) ; 
				echo    gui_tr_tag_open() ; 
					echo    gui_td_tag_open("100%",NULL,NULL,2,NULL,"td_data_bold",NULL,NULL) ; 
						//=========================================
						// E.   Analyse des indicateurs de bien-être et satisfaction
						echo gui_font_tag("titre_1",$LABEL_0180);
					echo    gui_td_tag_close() ; 
				echo    gui_tr_tag_close() ; 
				echo    gui_tr_tag_empty(1,2) ; 
				echo    gui_tr_tag_open() ; 
					echo    gui_td_tag_open("100%","center",NULL,2,NULL,NULL,NULL,NULL) ; 
						//=========================================
						// 1.   Graphique des indicateurs de bien-être et satisfaction
						echo gui_font_tag("titre_2_ssligne",$LABEL_0181);
					echo    gui_td_tag_close() ; 
				echo    gui_tr_tag_close() ; 
				echo    gui_tr_tag_empty(1,2) ; 
				
				echo    gui_tr_tag_open() ; 
					echo    gui_td_tag_open("","left","top",NULL,(count($tab_stat_all)),NULL,NULL,NULL) ; 
						
						$this->show_graph_parameters($GRAPH_SATISFACTION,$type_profil/*,$tab_stat[$inc0][0]*/) ; 
						
					echo    gui_td_tag_close() ; 
				echo    gui_tr_tag_close() ; 
			
				if(count($tab_stat)==1)
				{
					for($inc9=0,$stop9=(count($tab_stat_all)-1);$inc9<$stop9;$inc9++)
					{
						echo    gui_tr_tag_open() ; 
							echo    gui_td_tag_open("","center",NULL,NULL,NULL,NULL,NULL,NULL) ;; 
								echo gui_img_tag(NULL,NULL,NULL,NULL,NULL,"graphique_satisfaction_".$type_profil."_".$tab_stat_all[$inc9][0],NULL) ; 
							echo    gui_td_tag_close() ; 
						echo    gui_tr_tag_close() ; 
					}
				}
				
				for($inc0=0,$stop0=(count($tab_stat)-1);$inc0<$stop0;$inc0++)
				{	
					$tab_data_5 = $this->get_stat_satisfaction($this->last_year,$tab_stat[$inc0][0],$type_profil,NULL,$tmp2) ; 
					$name_img_bar = "";
					
					if($tab_data_5 != NULL && $tab_data_5[0][0] != NULL)
					{
						echo    gui_tr_tag_open() ; 
							echo    gui_td_tag_open("","center",NULL,NULL,NULL,NULL,NULL,NULL) ;
								$name_img_bar = draw_2D_ring($this->id_user,$tab_data_5,$tab_stat[$inc0][1]) ; 
								echo gui_img_tag($name_img_bar,NULL,NULL,NULL,NULL,"graphique_satisfaction_".$type_profil."_".$tab_stat[$inc0][0],NULL) ; 
							echo    gui_td_tag_close() ; 
						echo    gui_tr_tag_close() ; 
					}
					else
					{
						echo    gui_tr_tag_open() ; 
							echo    gui_td_tag_open("","center",NULL,NULL,NULL,NULL,NULL,NULL) ;; 
								echo gui_img_tag($name_img_bar,NULL,NULL,NULL,NULL,"graphique_satisfaction_".$type_profil."_".$tab_stat[$inc0][0],NULL) ; 
							echo    gui_td_tag_close() ; 
						echo    gui_tr_tag_close() ; 
					}
				}
					
				echo    gui_tr_tag_empty(1,2) ; 
				echo    gui_tr_tag_open() ; 
					echo    gui_td_tag_open("100%","center",NULL,2,NULL,NULL,NULL,NULL) ; 
						//=========================================
						// 2.   Revue des indicateurs de bien-être et satisfaction
						echo gui_font_tag("titre_2_ssligne",$LABEL_0182);
					echo    gui_td_tag_close() ; 
				 echo    gui_tr_tag_close() ;
				echo    gui_tr_tag_empty(1,2) ;  
				echo    gui_tr_tag_open() ; 
					echo    gui_td_tag_open("100%","center",NULL,2,NULL,NULL,NULL,NULL) ; 
						echo gui_div_tag_open("refresh_table_graphique_satisfaction_per_manager_".$type_profil); 
							$tmp[0] = $this->last_year ; 	
							echo    $this->get_table_satisfaction($tmp,$type_profil,NULL,$tmp2);
						echo gui_div_tag_close(); 
					echo    gui_td_tag_close() ; 
				 echo    gui_tr_tag_close() ;
				 echo    gui_tr_tag_empty(1,2) ;  
			echo    gui_table_tag_close() ; 
		}
		catch (Exception $e)
		{
			throw new Exception($e->getMessage());
		}
	}
	//============================================================================
	// get_stat_competence
	//============================================================================
	public function get_stat_competence($annee,$type_profil,$tab_node=NULL,$tab_manager=NULL)
	{
		try
		{
			GLOBAL  $REQUEST_200_1,$REQUEST_200_2 ; 
					
			$tab_arg = NULL; 
			$tab_stat= NULL;
			
			// Contruction de la requete
			$REQUEST = $REQUEST_200_1 ; 
			
			$tab_arg = array(':annee' => $annee);
			
			// On concatene les id_manager
			if($tab_manager!= NULL && count($tab_manager)>0)
			{
				for ($inc=0, $stop=count($tab_manager); $inc<$stop; $inc++) 
				{
					if($inc==0)
					{ 
						$REQUEST.= " AND app.id_manager IN (  ";
						$REQUEST.= (int)$tab_manager[$inc] ;
					}
					else        
						$REQUEST.= ",".(int)$tab_manager[$inc] ; 
				}
				$REQUEST.= " ) ";
			}
			
			// On concatene les noeud voulu
			if($tab_node!= NULL && count($tab_node)>0)
			{
				for ($inc=0, $stop=count($tab_node); $inc<$stop; $inc++) 
				{
					if($inc==0)
					{
						$REQUEST.= " AND uti.id_noeud IN (  ".(int)$tab_node[$inc] ;
					}
					else        
						$REQUEST.= ",".(int)$tab_node[$inc] ; 
				}
				$REQUEST.= " ) ";
			}
			
			$REQUEST.= $REQUEST_200_2 ; 
			
			$tab_stat = db_request_select($REQUEST , $tab_arg , $this->db_name);
			
			return $tab_stat ; 
		}
		catch (Exception $e)
		{
			throw new Exception($e->getMessage());
		}
	}
	//============================================================================
	// get_stat_trend
	//============================================================================
	public function get_stat_trend($annee,$type_profil,$tab_node=NULL,$tab_manager=NULL)
	{
		try
		{
			GLOBAL  $REQUEST_202_1,$REQUEST_202_2,$REQUEST_202_3;
			$tab_stat = NULL;
			
			// Contruction de la requete
			$REQUEST = "" ; 
			
			$tab_arg = array(':annee' => $annee);
			
			// On concatene les id_manager
			if($tab_manager!= NULL && count($tab_manager)>0)
			{
				for ($inc=0, $stop=count($tab_manager); $inc<$stop; $inc++) 
				{
					if($inc==0)
					{ 
						$REQUEST.= " AND app.id_manager IN (  ";
						$REQUEST.= (int)$tab_manager[$inc] ;
					}
					else        
						$REQUEST.= ",".(int)$tab_manager[$inc] ; 
				}
				$REQUEST.= " ) ";
			}
			
			// On concatene les noeud voulu
			if($tab_node!= NULL && count($tab_node)>0)
			{
				for ($inc=0, $stop=count($tab_node); $inc<$stop; $inc++) 
				{
					if($inc==0)
					{
						$REQUEST.= " AND uti.id_noeud IN (  ".(int)$tab_node[$inc] ;
					}
					else        
						$REQUEST.= ",".(int)$tab_node[$inc] ; 
				}
				$REQUEST.= " ) ";
			}
			
			$REQUEST_FINAL = $REQUEST_202_1.$REQUEST.$REQUEST_202_2.$REQUEST.$REQUEST_202_3 ; 
			$tab_stat = db_request_select($REQUEST_FINAL , $tab_arg , $this->db_name,0);
			
			return $tab_stat ; 
		}
		catch (Exception $e)
		{
			throw new Exception($e->getMessage());
		}
	}
	//============================================================================
	// get_stat_training_followed
	//============================================================================
	public function get_stat_training_followed($annee,$type_profil,$tab_node=NULL,$tab_manager=NULL)
	{
		try
		{
			GLOBAL  $REQUEST_213_1,$REQUEST_213_2;
			$tab_stat = NULL;
			
			// Contruction de la requete
			$REQUEST = "" ; 
			
			$tab_arg = array(':annee' => $annee);
			
			// On concatene les id_manager
			if($tab_manager!= NULL && count($tab_manager)>0)
			{
				for ($inc=0, $stop=count($tab_manager); $inc<$stop; $inc++) 
				{
					if($inc==0)
					{ 
						$REQUEST.= " AND app.id_manager IN (  ";
						$REQUEST.= (int)$tab_manager[$inc] ;
					}
					else        
						$REQUEST.= ",".(int)$tab_manager[$inc] ; 
				}
				$REQUEST.= " ) ";
			}
			
			// On concatene les noeud voulu
			if($tab_node!= NULL && count($tab_node)>0)
			{
				for ($inc=0, $stop=count($tab_node); $inc<$stop; $inc++) 
				{
					if($inc==0)
					{
						$REQUEST.= " AND uti.id_noeud IN (  ".(int)$tab_node[$inc] ;
					}
					else        
						$REQUEST.= ",".(int)$tab_node[$inc] ; 
				}
				$REQUEST.= " ) ";
			}
			
			$REQUEST_FINAL = $REQUEST_213_1.$REQUEST.$REQUEST_213_2 ; 
			$tab_stat = db_request_select($REQUEST_FINAL , $tab_arg , $this->db_name,0);
			
			return $tab_stat ; 
		}
		catch (Exception $e)
		{
			throw new Exception($e->getMessage());
		}
	}//============================================================================
	// get_stat_training_forecasted
	//============================================================================
	public function get_stat_training_forecasted($annee,$type_profil,$tab_node=NULL,$tab_manager=NULL)
	{
		try
		{
			GLOBAL  $REQUEST_214_1,$REQUEST_214_2;
			$tab_stat = NULL;
			
			// Contruction de la requete
			$REQUEST = "" ; 
			
			$tab_arg = array(':annee' => $annee);
			
			// On concatene les id_manager
			if($tab_manager!= NULL && count($tab_manager)>0)
			{
				for ($inc=0, $stop=count($tab_manager); $inc<$stop; $inc++) 
				{
					if($inc==0)
					{ 
						$REQUEST.= " AND app.id_manager IN (  ";
						$REQUEST.= (int)$tab_manager[$inc] ;
					}
					else        
						$REQUEST.= ",".(int)$tab_manager[$inc] ; 
				}
				$REQUEST.= " ) ";
			}
			
			// On concatene les noeud voulu
			if($tab_node!= NULL && count($tab_node)>0)
			{
				for ($inc=0, $stop=count($tab_node); $inc<$stop; $inc++) 
				{
					if($inc==0)
					{
						$REQUEST.= " AND uti.id_noeud IN (  ".(int)$tab_node[$inc] ;
					}
					else        
						$REQUEST.= ",".(int)$tab_node[$inc] ; 
				}
				$REQUEST.= " ) ";
			}
			
			$REQUEST_FINAL = $REQUEST_214_1.$REQUEST.$REQUEST_214_2 ; 
			$tab_stat = db_request_select($REQUEST_FINAL , $tab_arg , $this->db_name,0);
			
			return $tab_stat ; 
		}
		catch (Exception $e)
		{
			throw new Exception($e->getMessage());
		}
	}
	//============================================================================
	// get_stat_eval
	//============================================================================
	public function get_stat_eval($annee,$type_profil,$tab_node=NULL,$tab_manager=NULL)
	{
		try
		{
			GLOBAL $REQUEST_206_1,$REQUEST_206_2,$REQUEST_206_3;
			
			$tab_stat= NULL;
			
			// Contruction de la requete
			$REQUEST = "" ; 
			$tab_arg = array(':annee' => $annee);
			
			// On concatene les id_manager
			if($tab_manager!= NULL && count($tab_manager)>0)
			{
				for ($inc=0, $stop=count($tab_manager); $inc<$stop; $inc++) 
				{
					if($inc==0)
					{ 
						$REQUEST.= " AND app.id_manager IN (  ";
						$REQUEST.= (int)$tab_manager[$inc] ;
					}
					else        
						$REQUEST.= ",".(int)$tab_manager[$inc] ; 
				}
				$REQUEST.= " ) ";
			}
			// On concatene les noeud voulu
			if($tab_node!= NULL && count($tab_node)>0)
			{
				for ($inc=0, $stop=count($tab_node); $inc<$stop; $inc++) 
				{
					if($inc==0)
					{
						$REQUEST.= " AND uti.id_noeud IN (  ".(int)$tab_node[$inc] ;
					}
					else        
						$REQUEST.= ",".(int)$tab_node[$inc] ; 
				}
				$REQUEST.= " ) ";
			}
			
			$REQUEST_FINAL = $REQUEST_206_1.$REQUEST.$REQUEST_206_2.$REQUEST.$REQUEST_206_3 ; 
			
			$tab_stat = db_request_select($REQUEST_FINAL , $tab_arg , $this->db_name,0);
			
			return $tab_stat ; 
		}
		catch (Exception $e)
		{
			throw new Exception($e->getMessage());
		}
	}
	//============================================================================
	// get_stat_previous_objectives
	//============================================================================
	public function get_stat_previous_objectives($annee,$type_profil,$tab_node=NULL,$tab_manager=NULL)
	{
		try
		{
			GLOBAL $REQUEST_204_1,$REQUEST_204_2,$REQUEST_204_3;
			
			$tab_stat= NULL;
			
			// Contruction de la requete
			$REQUEST = "" ; 
			$tab_arg = array(':annee' => $annee);
			
			// On concatene les id_manager
			if($tab_manager!= NULL && count($tab_manager)>0)
			{
				for ($inc=0, $stop=count($tab_manager); $inc<$stop; $inc++) 
				{
					if($inc==0)
					{ 
						$REQUEST.= " AND app.id_manager IN (  ";
						$REQUEST.= (int)$tab_manager[$inc] ;
					}
					else        
						$REQUEST.= ",".(int)$tab_manager[$inc] ; 
				}
				$REQUEST.= " ) ";
			}
			// On concatene les noeud voulu
			if($tab_node!= NULL && count($tab_node)>0)
			{
				for ($inc=0, $stop=count($tab_node); $inc<$stop; $inc++) 
				{
					if($inc==0)
					{
						$REQUEST.= " AND uti.id_noeud IN (  ".(int)$tab_node[$inc] ;
					}
					else        
						$REQUEST.= ",".(int)$tab_node[$inc] ; 
				}
				$REQUEST.= " ) ";
			}
			
			$REQUEST_FINAL = $REQUEST_204_1.$REQUEST.$REQUEST_204_2.$REQUEST.$REQUEST_204_3 ; 
			
			$tab_stat = db_request_select($REQUEST_FINAL , $tab_arg , $this->db_name,0);
			
			return $tab_stat ; 
		}
		catch (Exception $e)
		{
			throw new Exception($e->getMessage());
		}
	}
	//============================================================================
	// get_stat_futur_objectives
	//============================================================================
	public function get_stat_futur_objectives($annee,$type_profil,$tab_node=NULL,$tab_manager=NULL)
	{
		try
		{
			GLOBAL $REQUEST_207_1,$REQUEST_207_2,$REQUEST_207_3;
			
			$tab_stat= NULL;
			
			// Contruction de la requete
			$REQUEST = "" ; 
			$tab_arg = array(':annee' => $annee);
			
			// On concatene les id_manager
			if($tab_manager!= NULL && count($tab_manager)>0)
			{
				for ($inc=0, $stop=count($tab_manager); $inc<$stop; $inc++) 
				{
					if($inc==0)
					{ 
						$REQUEST.= " AND app.id_manager IN (  ";
						$REQUEST.= (int)$tab_manager[$inc] ;
					}
					else        
						$REQUEST.= ",".(int)$tab_manager[$inc] ; 
				}
				$REQUEST.= " ) ";
			}
			// On concatene les noeud voulu
			if($tab_node!= NULL && count($tab_node)>0)
			{
				for ($inc=0, $stop=count($tab_node); $inc<$stop; $inc++) 
				{
					if($inc==0)
					{
						$REQUEST.= " AND uti.id_noeud IN (  ".(int)$tab_node[$inc] ;
					}
					else        
						$REQUEST.= ",".(int)$tab_node[$inc] ; 
				}
				$REQUEST.= " ) ";
			}
			
			$REQUEST_FINAL = $REQUEST_207_1.$REQUEST.$REQUEST_207_2.$REQUEST.$REQUEST_207_3 ; 
			
			$tab_stat = db_request_select($REQUEST_FINAL , $tab_arg , $this->db_name,0);
			
			return $tab_stat ; 
		}
		catch (Exception $e)
		{
			throw new Exception($e->getMessage());
		}
	}
	//============================================================================
	// get_stat_satisfaction
	// ATTENTION les critères de satisfaction doivent être identiques d'un modèle à l'autre
	// A CODER: Rechercher l'ensemble des libelle de critère différent et les compter
	//============================================================================
	public function get_stat_satisfaction($annee,$id_criterion,$type_profil,$tab_node=NULL,$tab_manager=NULL)
	{
		try
		{
			GLOBAL  $REQUEST_209_1,$REQUEST_209_2;
			
			$tab_arg = NULL; 
			$tab_stat= NULL;
			$tab_arg = array(':annee' => $annee );
			
			// Contruction de la requete
			$REQUEST = $REQUEST_209_1 ; 
			
			if($id_criterion==91 || $id_criterion==253 || $id_criterion==405 || $id_criterion==557 || $id_criterion==709 || $id_criterion==861 || $id_criterion==1013 || $id_criterion==1165 || $id_criterion==1317 || $id_criterion==1469)
				$REQUEST.= " AND cri.id_criterion IN (91,253,405,557,709,861,1013,1165,1317,1469) ";
			elseif($id_criterion==92 || $id_criterion==254 || $id_criterion==406 || $id_criterion==558 || $id_criterion==710 || $id_criterion==862 || $id_criterion==1014 || $id_criterion==1166 || $id_criterion==1318 || $id_criterion==1470)
				$REQUEST.= " AND cri.id_criterion IN (92,254,406,558,710,862,1014,1166,1318,1470) ";
			elseif($id_criterion==93 || $id_criterion==255 || $id_criterion==407 || $id_criterion==559 || $id_criterion==711 || $id_criterion==863 || $id_criterion==1015 || $id_criterion==1167 || $id_criterion==1319 || $id_criterion==1471)
				$REQUEST.= " AND cri.id_criterion IN (93,255,407,559,711,863,1015,1167,1319,1471) ";
			elseif($id_criterion==94 || $id_criterion==256 || $id_criterion==408 || $id_criterion==560 || $id_criterion==712 || $id_criterion==864 || $id_criterion==1016 || $id_criterion==1168 || $id_criterion==1320 || $id_criterion==1472)
				$REQUEST.= " AND cri.id_criterion IN (94,256,408,560,712,864,1016,1168,1320,1472) ";
			elseif($id_criterion==95 || $id_criterion==257 || $id_criterion==409 || $id_criterion==561 || $id_criterion==713 || $id_criterion==865 || $id_criterion==1017 || $id_criterion==1169 || $id_criterion==1321 || $id_criterion==1473)
				$REQUEST.= " AND cri.id_criterion IN (95,257,409,561,713,865,1017,1169,1321,1473) ";
			elseif($id_criterion==96 || $id_criterion==258 || $id_criterion==410 || $id_criterion==562 || $id_criterion==714 || $id_criterion==866 || $id_criterion==1018 || $id_criterion==1170 || $id_criterion==1322 || $id_criterion==1474)
				$REQUEST.= " AND cri.id_criterion IN (96,258,410,562,714,866,1018,1170,1322,1474) ";
			elseif($id_criterion==97 || $id_criterion==259 || $id_criterion==411 || $id_criterion==563 || $id_criterion==715 || $id_criterion==867 || $id_criterion==1019 || $id_criterion==1171 || $id_criterion==1323 || $id_criterion==1475)
				$REQUEST.= " AND cri.id_criterion IN (97,259,411,563,715,867,1019,1171,1323,1475) ";
			elseif($id_criterion==98 || $id_criterion==260 || $id_criterion==412 || $id_criterion==564 || $id_criterion==716 || $id_criterion==868 || $id_criterion==1020 || $id_criterion==1172 || $id_criterion==1324 || $id_criterion==1476)
				$REQUEST.= " AND cri.id_criterion IN (98,260,412,564,716,868,1020,1172,1324,1476) ";
			elseif($id_criterion==99 || $id_criterion==261 || $id_criterion==413 || $id_criterion==565 || $id_criterion==717 || $id_criterion==869 || $id_criterion==1021 || $id_criterion==1173 || $id_criterion==1325 || $id_criterion==1477)
				$REQUEST.= " AND cri.id_criterion IN (99,261,413,565,717,869,1021,1173,1325,1477) ";
			elseif($id_criterion==100 || $id_criterion==262 || $id_criterion==414 || $id_criterion==566 || $id_criterion==718 || $id_criterion==870 || $id_criterion==1022 || $id_criterion==1174 || $id_criterion==1326 || $id_criterion==1478)
				$REQUEST.= " AND cri.id_criterion IN (100,262,414,566,718,870,1022,1174,1326,1478) ";
				
			// On concatene les id_manager
			if($tab_manager!= NULL && count($tab_manager)>0)
			{
				for ($inc=0, $stop=count($tab_manager); $inc<$stop; $inc++) 
				{
					if($inc==0)
					{ 
						$REQUEST.= " AND app.id_manager IN (  ";
						$REQUEST.= (int)$tab_manager[$inc] ;
					}
					else        
						$REQUEST.= ",".(int)$tab_manager[$inc] ; 
				}
				$REQUEST.= " ) ";
			}
			
			// On concatene les noeud voulu
			if($tab_node!= NULL && count($tab_node)>0)
			{
				for ($inc=0, $stop=count($tab_node); $inc<$stop; $inc++) 
				{
					if($inc==0)
					{
						$REQUEST.= " AND uti.id_noeud IN (  ".(int)$tab_node[$inc] ;
					}
					else        
						$REQUEST.= ",".(int)$tab_node[$inc] ; 
				}
				$REQUEST.= " ) ";
			}
			
			$REQUEST.= $REQUEST_209_2 ; 
			
			$tab_stat = db_request_select($REQUEST , $tab_arg , $this->db_name);
			
			return $tab_stat ; 
		}
		catch (Exception $e)
		{
			throw new Exception($e->getMessage());
		}
	}
	public function concat_request_table($tab_annee,$tab_node=NULL,$tab_manager=NULL)
	{
		try
		{
			$REQUEST = "" ; 
			// On concatene les année
			if($tab_annee!= NULL && count($tab_annee)>0)
			{
				for ($inc=0, $stop=count($tab_annee); $inc<$stop; $inc++) 
				{
					if($inc==0)
					{ 
						$REQUEST = " AND DATE_FORMAT(app.date, '%Y') IN (  ";
						$REQUEST.= (int)$tab_annee[$inc];
					}
					else        
						$REQUEST.= ",".(int)$tab_annee[$inc] ; 
				}
				$REQUEST.= " ) ";
			}
			// On concatene les id_manager
			if($tab_manager!= NULL && count($tab_manager)>0)
			{
				for ($inc=0, $stop=count($tab_manager); $inc<$stop; $inc++) 
				{
					if($inc==0)
					{ 
						$REQUEST.= " AND app.id_manager IN (  ";
						$REQUEST.= (int)$tab_manager[$inc] ;
					}
					else        
						$REQUEST.= ",".(int)$tab_manager[$inc] ; 
				}
				$REQUEST.= " ) ";
			}
			
			// On concatene les noeud voulu
			if($tab_node!= NULL && count($tab_node)>0)
			{
				for ($inc=0, $stop=count($tab_node); $inc<$stop; $inc++) 
				{
					if($inc==0)
					{
						$REQUEST.= " AND uti.id_noeud IN (  ".(int)$tab_node[$inc] ;
					}
					else        
						$REQUEST.= ",".(int)$tab_node[$inc] ; 
				}
				$REQUEST.= " ) ";
			}
			return $REQUEST ; 
		}
		catch (Exception $e)
		{
			throw new Exception($e->getMessage());
		}
	}
	//============================================================================
	// show_table_competence
	//============================================================================
	public function show_table_competence($tab_annee,$type_profil,$tab_node=NULL,$tab_manager=NULL)
	{
		try
		{
			GLOBAL  $LABEL_0068,$LABEL_0071,$LABEL_0083,$LABEL_0084,$LABEL_0162,$LABEL_0163,$LABEL_0164,
					$REQUEST_201_1,$REQUEST_201_2,$REQUEST_218_1,$REQUEST_218_2,
					$PATH_CACHE_CHART,$ICON_CSV; 
			
			$data= NULL;
			$strReturn = "";
			
			// Contruction de la requete
			$REQUEST = $REQUEST_201_1 ; 
			$REQUEST.= $this->concat_request_table($tab_annee,$tab_node,$tab_manager) ; 
			$REQUEST.= $REQUEST_201_2 ; 
			$data = db_request_select($REQUEST , NULL , $this->db_name);
		
			//=========================================================================================
			// gestion du CSV
			//=========================================================================================
			// Contruction de la requete
			$REQUEST_CSV = $REQUEST_218_1 ; 
			$REQUEST_CSV.= $this->concat_request_table($tab_annee,$tab_node,$tab_manager) ; 
			$REQUEST_CSV.= $REQUEST_218_2 ; 
			$data_csv = db_request_select($REQUEST_CSV , NULL , $this->db_name);
			
			$name_file = $PATH_CACHE_CHART.$this->id_user."_csv_".rand(1,10000).date("YmdHis").".csv" ; 
			$titles = array ($LABEL_0164,$LABEL_0162,$LABEL_0068,$LABEL_0071,Strings::LABEL_0064,$LABEL_0163,$LABEL_0084,$LABEL_0083) ; 
			write_csv_file($titles,$name_file,$data_csv,7) ; 
			
			$strReturn.=    gui_table_tag_open("100%",0,5,0,NULL,NULL,NULL) ; 
			
				// Option CSV
				$strReturn.=    gui_tr_tag_open(NULL,NULL,NULL,NULL,NULL) ; 

				$icon_csv =     gui_jqueryui_ul_open();
				$icon_csv.=    "<a href=\"".$name_file."\" >";
				$icon_csv.=     gui_jqueryui_li_icon($ICON_CSV, "") ; 
				$icon_csv.=    "</a>";
				$icon_csv.=    gui_jqueryui_ul_close();
				
				$strReturn.=    gui_td_tag($icon_csv,"100%","center",NULL,6,NULL,NULL,NULL,NULL) ; 
				$strReturn.=    gui_tr_tag_close() ;
				
				$strReturn.=    gui_tr_tag_open(NULL,NULL,NULL,NULL,NULL) ; 
                    $strReturn.=    gui_th_tag($LABEL_0162,"10%","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
                    $strReturn.=    gui_th_tag(Strings::LABEL_0019,"10%","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
                    $strReturn.=    gui_th_tag($LABEL_0163,"30%","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
                    $strReturn.=    gui_th_tag($LABEL_0164,"10%","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
                    $strReturn.=    gui_th_tag($LABEL_0084,"30%","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
                    $strReturn.=    gui_th_tag($LABEL_0083,"10%","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
                $strReturn.=    gui_tr_tag_close() ;
				for($inc=0,$stop=(count($data));$inc<$stop;$inc++)
                {
                    $strReturn.=    gui_tr_tag_open(NULL,NULL,NULL,NULL,NULL) ; 
                    if($inc>0 && strcmp($data[$inc][0],$data[$inc-1][0])==0)
                    {
                        $strReturn.=    gui_td_tag("","","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
                        if($inc>0 && strcmp($data[$inc][1],$data[$inc-1][1])==0)
                        {
                            $strReturn.=    gui_td_tag("","","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
                            if($inc>0 && strcmp($data[$inc][2],$data[$inc-1][2])==0)
                            {   
			                    $strReturn.=    gui_td_tag("","","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
			                    $strReturn.=    gui_td_tag($data[$inc][3],"","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
			                    $strReturn.=    gui_td_tag($data[$inc][4],"","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
			                    $strReturn.=    gui_td_tag($data[$inc][5],"","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
			                }
			                else
			                {
			                    $strReturn.=    gui_td_tag($data[$inc][2],"","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
			                    $strReturn.=    gui_td_tag($data[$inc][3],"","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
			                    $strReturn.=    gui_td_tag($data[$inc][4],"","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
			                    $strReturn.=    gui_td_tag($data[$inc][5],"","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
			                }
                        }
                        else
                        {
                            $strReturn.=    gui_td_tag($data[$inc][1],"","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
                            $strReturn.=    gui_td_tag($data[$inc][2],"","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
		                    $strReturn.=    gui_td_tag($data[$inc][3],"","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
		                    $strReturn.=    gui_td_tag($data[$inc][4],"","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
		                    $strReturn.=    gui_td_tag($data[$inc][5],"","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
                        }
                    }
                    else
                    {
	                    $strReturn.=    gui_td_tag($data[$inc][0],"","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
	                    $strReturn.=    gui_td_tag($data[$inc][1],"","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
	                    $strReturn.=    gui_td_tag($data[$inc][2],"","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
	                    $strReturn.=    gui_td_tag($data[$inc][3],"","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
	                    $strReturn.=    gui_td_tag($data[$inc][4],"","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
	                    $strReturn.=    gui_td_tag($data[$inc][5],"","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
	                }
                    $strReturn.=    gui_tr_tag_close() ;
                }
				
			$strReturn.=    gui_table_tag_close() ; 
			return $strReturn;
		}
		catch (Exception $e)
		{
			throw new Exception($e->getMessage());
		}
	}
	//============================================================================
	// get_table_trend
	//============================================================================
	public function get_table_trend($tab_annee,$type_profil,$tab_node=NULL,$tab_manager=NULL)
	{
		try
		{
			GLOBAL  $LABEL_0068,$LABEL_0071,$LABEL_0084,$LABEL_0164,$LABEL_0167,$LABEL_0175,$LABEL_0203,
					$REQUEST_203_1,$REQUEST_203_2,$REQUEST_219_1,$REQUEST_219_2,
					$PATH_CACHE_CHART,$ICON_CSV; 
			
			$tab_stat= NULL;
			
			$strReturn = "";
			
			// Contruction de la requete
			$REQUEST = $REQUEST_203_1 ; 
			$REQUEST.= $this->concat_request_table($tab_annee,$tab_node,$tab_manager) ; 
			$REQUEST.= $REQUEST_203_2 ; 
			$data = db_request_select($REQUEST , NULL , $this->db_name,0);
						
			//=========================================================================================
			// gestion du CSV
			//=========================================================================================
			// Contruction de la requete
			$REQUEST_CSV = $REQUEST_219_1 ; 
			$REQUEST_CSV.= $this->concat_request_table($tab_annee,$tab_node,$tab_manager) ; 
			$REQUEST_CSV.= $REQUEST_219_2 ; 
			$data_csv = db_request_select($REQUEST_CSV , NULL , $this->db_name);
			
			$name_file = $PATH_CACHE_CHART.$this->id_user."_csv_".rand(1,10000).date("YmdHis").".csv" ; 
			$titles = array ($LABEL_0164,$LABEL_0068,$LABEL_0071,Strings::LABEL_0064,$LABEL_0203,$LABEL_0167,$LABEL_0084) ; 
			write_csv_file($titles,$name_file,$data_csv,7) ; 
				
			$strReturn.=    gui_table_tag_open("100%",0,5,0,NULL,NULL,NULL) ; 	
			
				// Option CSV
				$strReturn.=    gui_tr_tag_open(NULL,NULL,NULL,NULL,NULL) ; 
				
				$icon_csv =     gui_jqueryui_ul_open();
				$icon_csv.=    "<a href=\"".$name_file."\" >";
				$icon_csv.=     gui_jqueryui_li_icon($ICON_CSV, "") ; 
				$icon_csv.=    "</a>";
				$icon_csv.=    gui_jqueryui_ul_close();
				
				$strReturn.=    gui_td_tag($icon_csv,"100%","center",NULL,6,NULL,NULL,NULL,NULL) ; 
				$strReturn.=    gui_tr_tag_close() ;
				
				$strReturn.=    gui_tr_tag_open(NULL,NULL,NULL,NULL,NULL) ; 
                    $strReturn.=    gui_th_tag(Strings::LABEL_0050,"10%","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
                    $strReturn.=    gui_th_tag(Strings::LABEL_0019,"10%","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
                    $strReturn.=    gui_th_tag($LABEL_0164,"30%","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
                    $strReturn.=    gui_th_tag($LABEL_0175,"10%","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
                    $strReturn.=    gui_th_tag($LABEL_0167,"30%","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
                    $strReturn.=    gui_th_tag($LABEL_0084,"10%","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
                $strReturn.=    gui_tr_tag_close() ;
                
				for($inc=0,$stop=(count($data));$inc<$stop;$inc++)
                {
                    $strReturn.=    gui_tr_tag_open(NULL,NULL,NULL,NULL,NULL) ; 
                    if($inc>0 && strcmp($data[$inc][0],$data[$inc-1][0])==0)
                    {
                        $strReturn.=    gui_td_tag("","","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
                        if($inc>0 && strcmp($data[$inc][1],$data[$inc-1][1])==0)
                        {
                            $strReturn.=    gui_td_tag("","","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
                            if($inc>0 && strcmp($data[$inc][2],$data[$inc-1][2])==0)
                            {   
			                    $strReturn.=    gui_td_tag("","","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
			                    $strReturn.=    gui_td_tag($data[$inc][3],"","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
			                    $strReturn.=    gui_td_tag($data[$inc][4],"","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
			                    $strReturn.=    gui_td_tag($data[$inc][5],"","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
			                }
			                else
			                {
			                    $strReturn.=    gui_td_tag($data[$inc][2],"","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
			                    $strReturn.=    gui_td_tag($data[$inc][3],"","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
			                    $strReturn.=    gui_td_tag($data[$inc][4],"","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
			                    $strReturn.=    gui_td_tag($data[$inc][5],"","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
			                }
                        }
                        else
                        {
                            $strReturn.=    gui_td_tag($data[$inc][1],"","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
                            $strReturn.=    gui_td_tag($data[$inc][2],"","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
		                    $strReturn.=    gui_td_tag($data[$inc][3],"","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
		                    $strReturn.=    gui_td_tag($data[$inc][4],"","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
		                    $strReturn.=    gui_td_tag($data[$inc][5],"","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
                        }
                    }
                    else
                    {
	                    $strReturn.=    gui_td_tag($data[$inc][0],"","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
	                    $strReturn.=    gui_td_tag($data[$inc][1],"","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
	                    $strReturn.=    gui_td_tag($data[$inc][2],"","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
	                    $strReturn.=    gui_td_tag($data[$inc][3],"","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
	                    $strReturn.=    gui_td_tag($data[$inc][4],"","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
	                    $strReturn.=    gui_td_tag($data[$inc][5],"","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
	                }
                    $strReturn.=    gui_tr_tag_close() ;
                }
			$strReturn.=    gui_table_tag_close() ; 
			return $strReturn;
		}
		catch (Exception $e)
		{
			throw new Exception($e->getMessage());
		}
	}
	//============================================================================
	// get_table_training_followed
	//============================================================================
	public function get_table_training_followed($tab_annee,$type_profil,$tab_node=NULL,$tab_manager=NULL)
	{
		try
		{
			GLOBAL  $LABEL_0068,$LABEL_0071,$LABEL_0084,$LABEL_0164,$LABEL_0167,$LABEL_0199,$LABEL_0200,
					$REQUEST_215_1,$REQUEST_215_2,$REQUEST_220_1,$REQUEST_220_2,
					$PATH_CACHE_CHART,$ICON_CSV; 
			
			$tab_stat= NULL;
			
			$strReturn = "";
			
			// Contruction de la requete
			$REQUEST = $REQUEST_215_1 ; 
			$REQUEST.= $this->concat_request_table($tab_annee,$tab_node,$tab_manager) ; 
			$REQUEST.= $REQUEST_215_2 ; 
			$data = db_request_select($REQUEST , NULL , $this->db_name,0);
			
			//=========================================================================================
			// gestion du CSV
			//=========================================================================================
			// Contruction de la requete
			$REQUEST_CSV = $REQUEST_220_1 ; 
			$REQUEST_CSV.= $this->concat_request_table($tab_annee,$tab_node,$tab_manager) ; 
			$REQUEST_CSV.= $REQUEST_220_2 ; 
			$data_csv = db_request_select($REQUEST_CSV , NULL , $this->db_name);
			
			$name_file = $PATH_CACHE_CHART.$this->id_user."_csv_".rand(1,10000).date("YmdHis").".csv" ; 
			$titles = array ($LABEL_0164,$LABEL_0068,$LABEL_0071,Strings::LABEL_0064,$LABEL_0199,$LABEL_0167,$LABEL_0200) ; 
			write_csv_file($titles,$name_file,$data_csv,6) ; 
						
			$strReturn.=    gui_table_tag_open("100%",0,5,0,NULL,NULL,NULL) ; 	
			
				// Option CSV
				$strReturn.=    gui_tr_tag_open(NULL,NULL,NULL,NULL,NULL) ; 
				
				$icon_csv =     gui_jqueryui_ul_open();
				$icon_csv.=    "<a href=\"".$name_file."\" >";
				$icon_csv.=     gui_jqueryui_li_icon($ICON_CSV, "") ; 
				$icon_csv.=    "</a>";
				$icon_csv.=    gui_jqueryui_ul_close();
				
				$strReturn.=    gui_td_tag($icon_csv,"100%","center",NULL,6,NULL,NULL,NULL,NULL) ; 
				$strReturn.=    gui_tr_tag_close() ;
				
				$strReturn.=    gui_tr_tag_open(NULL,NULL,NULL,NULL,NULL) ; 
                    $strReturn.=    gui_th_tag($LABEL_0164,"5%","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
                    $strReturn.=    gui_th_tag(Strings::LABEL_0050,"15%","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
                    $strReturn.=    gui_th_tag(Strings::LABEL_0019,"15%","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
                    $strReturn.=    gui_th_tag($LABEL_0199,"20%","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
                    $strReturn.=    gui_th_tag($LABEL_0084,"30%","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
                    $strReturn.=    gui_th_tag($LABEL_0200,"15%","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
                $strReturn.=    gui_tr_tag_close() ;
				for($inc=0,$stop=(count($data));$inc<$stop;$inc++)
                {
                    $strReturn.=    gui_tr_tag_open(NULL,NULL,NULL,NULL,NULL) ; 
                    if($inc>0 && strcmp($data[$inc][0],$data[$inc-1][0])==0)
                    {
                        $strReturn.=    gui_td_tag("","","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
                        if($inc>0 && strcmp($data[$inc][1],$data[$inc-1][1])==0)
                        {
                            $strReturn.=    gui_td_tag("","","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
                            if($inc>0 && strcmp($data[$inc][2],$data[$inc-1][2])==0)
                            {   
			                    $strReturn.=    gui_td_tag("","","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
			                    $strReturn.=    gui_td_tag($data[$inc][3],"","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
			                    $strReturn.=    gui_td_tag($data[$inc][4],"","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
			                    $strReturn.=    gui_td_tag($data[$inc][5],"","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
			                }
			                else
			                {
			                    $strReturn.=    gui_td_tag($data[$inc][2],"","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
			                    $strReturn.=    gui_td_tag($data[$inc][3],"","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
			                    $strReturn.=    gui_td_tag($data[$inc][4],"","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
			                    $strReturn.=    gui_td_tag($data[$inc][5],"","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
			                }
                        }
                        else
                        {
                            $strReturn.=    gui_td_tag($data[$inc][1],"","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
                            $strReturn.=    gui_td_tag($data[$inc][2],"","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
		                    $strReturn.=    gui_td_tag($data[$inc][3],"","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
		                    $strReturn.=    gui_td_tag($data[$inc][4],"","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
		                    $strReturn.=    gui_td_tag($data[$inc][5],"","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
                        }
                    }
                    else
                    {
	                    $strReturn.=    gui_td_tag($data[$inc][0],"","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
	                    $strReturn.=    gui_td_tag($data[$inc][1],"","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
	                    $strReturn.=    gui_td_tag($data[$inc][2],"","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
	                    $strReturn.=    gui_td_tag($data[$inc][3],"","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
	                    $strReturn.=    gui_td_tag($data[$inc][4],"","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
	                    $strReturn.=    gui_td_tag($data[$inc][5],"","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
	                }
                    $strReturn.=    gui_tr_tag_close() ;
                }
			$strReturn.=    gui_table_tag_close() ; 
			return $strReturn;
		}
		catch (Exception $e)
		{
			throw new Exception($e->getMessage());
		}
	}
	//============================================================================
	// get_table_training_forecasted
	//============================================================================
	public function get_table_training_forecasted($tab_annee,$type_profil,$tab_node=NULL,$tab_manager=NULL)
	{
		try
		{
			GLOBAL  $LABEL_0068,$LABEL_0071,$LABEL_0084,$LABEL_0164,$LABEL_0167,$LABEL_0205,$LABEL_0204,
					$REQUEST_216_1,$REQUEST_216_2,$REQUEST_221_1,$REQUEST_221_2,
					$PATH_CACHE_CHART,$ICON_CSV; 
			
			$tab_stat= NULL;
			
			$strReturn = "";
			
			// Contruction de la requete
			$REQUEST = $REQUEST_216_1 ; 
			$REQUEST.= $this->concat_request_table($tab_annee,$tab_node,$tab_manager) ; 
			$REQUEST.= $REQUEST_216_2 ; 
			$data = db_request_select($REQUEST , NULL , $this->db_name,0);
						
			//=========================================================================================
			// gestion du CSV
			//=========================================================================================
			// Contruction de la requete
			$REQUEST_CSV = $REQUEST_221_1 ; 
			$REQUEST_CSV.= $this->concat_request_table($tab_annee,$tab_node,$tab_manager) ; 
			$REQUEST_CSV.= $REQUEST_221_2 ; 
			$data_csv = db_request_select($REQUEST_CSV , NULL , $this->db_name);
			
			$name_file = $PATH_CACHE_CHART.$this->id_user."_csv_".rand(1,10000).date("YmdHis").".csv" ; 
			$titles = array ($LABEL_0164,$LABEL_0068,$LABEL_0071,Strings::LABEL_0064,$LABEL_0204,$LABEL_0084,$LABEL_0205) ; 
			write_csv_file($titles,$name_file,$data_csv,6) ; 
			
			$strReturn.=    gui_table_tag_open("100%",0,5,0,NULL,NULL,NULL) ; 	
				
				// Option CSV
				$strReturn.=    gui_tr_tag_open(NULL,NULL,NULL,NULL,NULL) ; 
				
				$icon_csv =     gui_jqueryui_ul_open();
				$icon_csv.=    "<a href=\"".$name_file."\" >";
				$icon_csv.=     gui_jqueryui_li_icon($ICON_CSV, "") ; 
				$icon_csv.=    "</a>";
				$icon_csv.=    gui_jqueryui_ul_close();
				
				$strReturn.=    gui_td_tag($icon_csv,"100%","center",NULL,6,NULL,NULL,NULL,NULL) ; 
				$strReturn.=    gui_tr_tag_close() ;
				
				$strReturn.=    gui_tr_tag_open(NULL,NULL,NULL,NULL,NULL) ; 
                    $strReturn.=    gui_th_tag($LABEL_0164,"5%","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
                    $strReturn.=    gui_th_tag(Strings::LABEL_0050,"15%","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
                    $strReturn.=    gui_th_tag(Strings::LABEL_0019,"15%","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
                    $strReturn.=    gui_th_tag($LABEL_0204,"20%","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
                    $strReturn.=    gui_th_tag($LABEL_0084,"30%","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
                    $strReturn.=    gui_th_tag($LABEL_0205,"15%","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
                $strReturn.=    gui_tr_tag_close() ;
				for($inc=0,$stop=(count($data));$inc<$stop;$inc++)
                {
                    $strReturn.=    gui_tr_tag_open(NULL,NULL,NULL,NULL,NULL) ; 
                    if($inc>0 && strcmp($data[$inc][0],$data[$inc-1][0])==0)
                    {
                        $strReturn.=    gui_td_tag("","","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
                        if($inc>0 && strcmp($data[$inc][1],$data[$inc-1][1])==0)
                        {
                            $strReturn.=    gui_td_tag("","","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
                            if($inc>0 && strcmp($data[$inc][2],$data[$inc-1][2])==0)
                            {   
			                    $strReturn.=    gui_td_tag("","","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
			                    $strReturn.=    gui_td_tag($data[$inc][3],"","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
			                    $strReturn.=    gui_td_tag($data[$inc][4],"","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
			                    $strReturn.=    gui_td_tag($data[$inc][5],"","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
			                }
			                else
			                {
			                    $strReturn.=    gui_td_tag($data[$inc][2],"","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
			                    $strReturn.=    gui_td_tag($data[$inc][3],"","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
			                    $strReturn.=    gui_td_tag($data[$inc][4],"","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
			                    $strReturn.=    gui_td_tag($data[$inc][5],"","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
			                }
                        }
                        else
                        {
                            $strReturn.=    gui_td_tag($data[$inc][1],"","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
                            $strReturn.=    gui_td_tag($data[$inc][2],"","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
		                    $strReturn.=    gui_td_tag($data[$inc][3],"","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
		                    $strReturn.=    gui_td_tag($data[$inc][4],"","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
		                    $strReturn.=    gui_td_tag($data[$inc][5],"","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
                        }
                    }
                    else
                    {
	                    $strReturn.=    gui_td_tag($data[$inc][0],"","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
	                    $strReturn.=    gui_td_tag($data[$inc][1],"","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
	                    $strReturn.=    gui_td_tag($data[$inc][2],"","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
	                    $strReturn.=    gui_td_tag($data[$inc][3],"","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
	                    $strReturn.=    gui_td_tag($data[$inc][4],"","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
	                    $strReturn.=    gui_td_tag($data[$inc][5],"","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
	                }
                    $strReturn.=    gui_tr_tag_close() ;
                }
			$strReturn.=    gui_table_tag_close() ; 
			return $strReturn;
		}
		catch (Exception $e)
		{
			throw new Exception($e->getMessage());
		}
	}
	//============================================================================
	// get_table_previous_objectives()
	//============================================================================
	public function get_table_previous_objectives($tab_annee,$type_profil,$tab_node=NULL,$tab_manager=NULL)
	{
		try
		{
			GLOBAL  $LABEL_0068,$LABEL_0071,$LABEL_0164,$LABEL_0086,$LABEL_0084,$LABEL_0085,$LABEL_0172,$LABEL_0202,
					$REQUEST_205_1,$REQUEST_205_2,$REQUEST_222_1,$REQUEST_222_2,
					$PATH_CACHE_CHART,$ICON_CSV;  
					
			$tab_stat= NULL;
			
			$strReturn = "";
			
			// Contruction de la requete
			$REQUEST = $REQUEST_205_1 ; 
			$REQUEST.= $this->concat_request_table($tab_annee,$tab_node,$tab_manager) ; 
			$REQUEST.= $REQUEST_205_2 ; 
			$data = db_request_select($REQUEST , NULL , $this->db_name,0);
			
			//=========================================================================================
			// gestion du CSV
			//=========================================================================================
			// Contruction de la requete
			$REQUEST_CSV = $REQUEST_222_1 ; 
			$REQUEST_CSV.= $this->concat_request_table($tab_annee,$tab_node,$tab_manager) ; 
			$REQUEST_CSV.= $REQUEST_222_2 ; 
			$data_csv = db_request_select($REQUEST_CSV , NULL , $this->db_name);
			
			$name_file = $PATH_CACHE_CHART.$this->id_user."_csv_".rand(1,10000).date("YmdHis").".csv" ; 
			$titles = array ($LABEL_0164,$LABEL_0068,$LABEL_0071,Strings::LABEL_0064,$LABEL_0085,$LABEL_0084,$LABEL_0202) ; 
			write_csv_file($titles,$name_file,$data_csv,6) ; 
			
			$strReturn.=    gui_table_tag_open("100%",0,5,0,NULL,NULL,NULL) ; 
				
				// Option CSV
				$strReturn.=    gui_tr_tag_open(NULL,NULL,NULL,NULL,NULL) ; 
				
				$icon_csv =     gui_jqueryui_ul_open();
				$icon_csv.=    "<a href=\"".$name_file."\" >";
				$icon_csv.=     gui_jqueryui_li_icon($ICON_CSV, "") ; 
				$icon_csv.=    "</a>";
				$icon_csv.=    gui_jqueryui_ul_close();
				
				$strReturn.=    gui_td_tag($icon_csv,"100%","center",NULL,6,NULL,NULL,NULL,NULL) ; 
				$strReturn.=    gui_tr_tag_close() ;
				
				$strReturn.=    gui_tr_tag_open(NULL,NULL,NULL,NULL,NULL) ; 
                    $strReturn.=    gui_th_tag(Strings::LABEL_0050,"10%","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
                    $strReturn.=    gui_th_tag(Strings::LABEL_0019,"10%","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
                    $strReturn.=    gui_th_tag($LABEL_0164,"30%","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
                    $strReturn.=    gui_th_tag($LABEL_0172,"10%","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
                    $strReturn.=    gui_th_tag($LABEL_0086,"30%","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
                    $strReturn.=    gui_th_tag($LABEL_0084,"10%","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
                $strReturn.=    gui_tr_tag_close() ;
				for($inc=0,$stop=(count($data));$inc<$stop;$inc++)
                {
                    $strReturn.=    gui_tr_tag_open(NULL,NULL,NULL,NULL,NULL) ; 
                    if($inc>0 && strcmp($data[$inc][0],$data[$inc-1][0])==0)
                    {
                        $strReturn.=    gui_td_tag("","","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
                        if($inc>0 && strcmp($data[$inc][1],$data[$inc-1][1])==0)
                        {
                            $strReturn.=    gui_td_tag("","","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
                            if($inc>0 && strcmp($data[$inc][2],$data[$inc-1][2])==0)
                            {   
			                    $strReturn.=    gui_td_tag("","","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
			                    $strReturn.=    gui_td_tag($data[$inc][3],"","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
			                    $strReturn.=    gui_td_tag($data[$inc][4],"","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
			                    $strReturn.=    gui_td_tag($data[$inc][5],"","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
			                }
			                else
			                {
			                    $strReturn.=    gui_td_tag($data[$inc][2],"","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
			                    $strReturn.=    gui_td_tag($data[$inc][3],"","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
			                    $strReturn.=    gui_td_tag($data[$inc][4],"","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
			                    $strReturn.=    gui_td_tag($data[$inc][5],"","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
			                }
                        }
                        else
                        {
                            $strReturn.=    gui_td_tag($data[$inc][1],"","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
                            $strReturn.=    gui_td_tag($data[$inc][2],"","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
		                    $strReturn.=    gui_td_tag($data[$inc][3],"","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
		                    $strReturn.=    gui_td_tag($data[$inc][4],"","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
		                    $strReturn.=    gui_td_tag($data[$inc][5],"","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
                        }
                    }
                    else
                    {
	                    $strReturn.=    gui_td_tag($data[$inc][0],"","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
	                    $strReturn.=    gui_td_tag($data[$inc][1],"","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
	                    $strReturn.=    gui_td_tag($data[$inc][2],"","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
	                    $strReturn.=    gui_td_tag($data[$inc][3],"","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
	                    $strReturn.=    gui_td_tag($data[$inc][4],"","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
	                    $strReturn.=    gui_td_tag($data[$inc][5],"","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
	                }
                    $strReturn.=    gui_tr_tag_close() ;
                }
				
			$strReturn.=    gui_table_tag_close() ; 
			return $strReturn ; 
		}
		catch (Exception $e)
		{
			throw new Exception($e->getMessage());
		}
	}
	//============================================================================
	// get_table_futur_objectives()
	//============================================================================
	public function get_table_futur_objectives($tab_annee,$type_profil,$tab_node=NULL,$tab_manager=NULL)
	{
		try
		{
			GLOBAL  $LABEL_0068,$LABEL_0071,$LABEL_0084,$LABEL_0093,$LABEL_0164,$LABEL_0172,$LABEL_0206,
					$REQUEST_208_1,$REQUEST_208_2,$REQUEST_223_1,$REQUEST_223_2,
					$PATH_CACHE_CHART,$ICON_CSV; 
					
			$tab_stat= NULL;
			
			$strReturn = "";
			
			// Contruction de la requete
			$REQUEST = $REQUEST_208_1 ; 
			$REQUEST.= $this->concat_request_table($tab_annee,$tab_node,$tab_manager) ; 
			$REQUEST.= $REQUEST_208_2 ; 
			$data = db_request_select($REQUEST , NULL , $this->db_name,0);
			
			//=========================================================================================
			// gestion du CSV
			//=========================================================================================
			// Contruction de la requete
			$REQUEST_CSV = $REQUEST_223_1 ; 
			$REQUEST_CSV.= $this->concat_request_table($tab_annee,$tab_node,$tab_manager) ; 
			$REQUEST_CSV.= $REQUEST_223_2 ; 
			$data_csv = db_request_select($REQUEST_CSV , NULL , $this->db_name);
			
			$name_file = $PATH_CACHE_CHART.$this->id_user."_csv_".rand(1,10000).date("YmdHis").".csv" ; 
			$titles = array ($LABEL_0164,$LABEL_0068,$LABEL_0071,Strings::LABEL_0064,$LABEL_0206,$LABEL_0084,$LABEL_0093) ; 
			write_csv_file($titles,$name_file,$data_csv,7) ; 
			
			$strReturn.=    gui_table_tag_open("100%",0,5,0,NULL,NULL,NULL) ; 
				
				// Option CSV
				$strReturn.=    gui_tr_tag_open(NULL,NULL,NULL,NULL,NULL) ; 
				
				$icon_csv =     gui_jqueryui_ul_open();
				$icon_csv.=     "<a href=\"".$name_file."\" >";
				$icon_csv.=     gui_jqueryui_li_icon($ICON_CSV, "") ; 
				$icon_csv.=     "</a>";
				$icon_csv.=     gui_jqueryui_ul_close();
				
				$strReturn.=    gui_td_tag($icon_csv,"100%","center",NULL,6,NULL,NULL,NULL,NULL) ; 
				$strReturn.=    gui_tr_tag_close() ;
				
				$strReturn.=    gui_tr_tag_open(NULL,NULL,NULL,NULL,NULL) ; 
                    $strReturn.=    gui_th_tag($LABEL_0050,"20%","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
                    $strReturn.=    gui_th_tag(Strings::LABEL_0019,"20%","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
                    $strReturn.=    gui_th_tag($LABEL_0164,"10%","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
                    $strReturn.=    gui_th_tag($LABEL_0172,"40%","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
                    $strReturn.=    gui_th_tag($LABEL_0093,"10%","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
                $strReturn.=    gui_tr_tag_close() ;
				for($inc=0,$stop=(count($data));$inc<$stop;$inc++)
                {
                    $strReturn.=    gui_tr_tag_open(NULL,NULL,NULL,NULL,NULL) ; 
                    if($inc>0 && strcmp($data[$inc][0],$data[$inc-1][0])==0)
                    {
                        $strReturn.=    gui_td_tag("","","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
                        if($inc>0 && strcmp($data[$inc][1],$data[$inc-1][1])==0)
                        {
                            $strReturn.=    gui_td_tag("","","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
                            if($inc>0 && strcmp($data[$inc][2],$data[$inc-1][2])==0)
                            {   
			                    $strReturn.=    gui_td_tag("","","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
			                    $strReturn.=    gui_td_tag($data[$inc][3],"","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
			                    $strReturn.=    gui_td_tag($data[$inc][4],"","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
			                }
			                else
			                {
			                    $strReturn.=    gui_td_tag($data[$inc][2],"","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
			                    $strReturn.=    gui_td_tag($data[$inc][3],"","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
			                    $strReturn.=    gui_td_tag($data[$inc][4],"","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
			                }
                        }
                        else
                        {
                            $strReturn.=    gui_td_tag($data[$inc][1],"","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
                            $strReturn.=    gui_td_tag($data[$inc][2],"","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
		                    $strReturn.=    gui_td_tag($data[$inc][3],"","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
		                    $strReturn.=    gui_td_tag($data[$inc][4],"","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
                        }
                    }
                    else
                    {
	                    $strReturn.=    gui_td_tag($data[$inc][0],"","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
	                    $strReturn.=    gui_td_tag($data[$inc][1],"","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
	                    $strReturn.=    gui_td_tag($data[$inc][2],"","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
	                    $strReturn.=    gui_td_tag($data[$inc][3],"","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
	                    $strReturn.=    gui_td_tag($data[$inc][4],"","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
	                }
                    $strReturn.=    gui_tr_tag_close() ;
                }
			$strReturn.=    gui_table_tag_close() ; 
			return $strReturn;
		}
		catch (Exception $e)
		{
			throw new Exception($e->getMessage());
		}
	}
	//============================================================================
	// get_table_satisfaction()
	//============================================================================
	public function get_table_satisfaction($tab_annee,$type_profil,$tab_node=NULL,$tab_manager=NULL)
	{
		try
		{
			GLOBAL  $LABEL_0068,$LABEL_0071,$LABEL_0164,$LABEL_0184,$LABEL_0084,$LABEL_0183,$LABEL_0184,$LABEL_0207,
					$REQUEST_211_1,$REQUEST_211_2,$REQUEST_224_1,$REQUEST_224_2,
					$PATH_CACHE_CHART,$ICON_CSV; 
					
			$tab_stat= NULL;
			
			$strReturn = "";
			
			// Contruction de la requete
			$REQUEST = $REQUEST_211_1 ; 
			$REQUEST.= $this->concat_request_table($tab_annee,$tab_node,$tab_manager) ; 
			$REQUEST.= $REQUEST_211_2 ; 
			$data = db_request_select($REQUEST , NULL , $this->db_name,0);
			
			//=========================================================================================
			// gestion du CSV
			//=========================================================================================
			// Contruction de la requete
			$REQUEST_CSV = $REQUEST_224_1 ; 
			$REQUEST_CSV.= $this->concat_request_table($tab_annee,$tab_node,$tab_manager) ; 
			$REQUEST_CSV.= $REQUEST_224_2 ; 
			$data_csv = db_request_select($REQUEST_CSV , NULL , $this->db_name);
			
			$name_file = $PATH_CACHE_CHART.$this->id_user."_csv_".rand(1,10000).date("YmdHis").".csv" ; 
			$titles = array ($LABEL_0164,$LABEL_0068,$LABEL_0071,Strings::LABEL_0064,$LABEL_0207,$LABEL_0084,$LABEL_0184) ; 
			write_csv_file($titles,$name_file,$data_csv,6) ; 
			
			$strReturn.=    gui_table_tag_open("100%",0,5,0,NULL,NULL,NULL) ; 
				
				// Option CSV
				$strReturn.=    gui_tr_tag_open(NULL,NULL,NULL,NULL,NULL) ; 
				
				$icon_csv =     gui_jqueryui_ul_open();
				$icon_csv.=     "<a href=\"".$name_file."\" >";
				$icon_csv.=     gui_jqueryui_li_icon($ICON_CSV, "") ; 
				$icon_csv.=     "</a>";
				$icon_csv.=     gui_jqueryui_ul_close();
				
				$strReturn.=    gui_td_tag($icon_csv,"100%","center",NULL,6,NULL,NULL,NULL,NULL) ; 
				$strReturn.=    gui_tr_tag_close() ;
				
				$strReturn.=    gui_tr_tag_open(NULL,NULL,NULL,NULL,NULL) ; 
                    $strReturn.=    gui_th_tag(Strings::LABEL_0050,"15%","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
                    $strReturn.=    gui_th_tag(Strings::LABEL_0019,"15%","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
                    $strReturn.=    gui_th_tag($LABEL_0164,"10%","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
                    $strReturn.=    gui_th_tag($LABEL_0183,"30%","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
                    $strReturn.=    gui_th_tag($LABEL_0184,"10%","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
                    $strReturn.=    gui_th_tag($LABEL_0084,"20%","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
                $strReturn.=    gui_tr_tag_close() ;
				for($inc=0,$stop=(count($data)-1);$inc<$stop;$inc++)
                {
                    $strReturn.=    gui_tr_tag_open(NULL,NULL,NULL,NULL,NULL) ; 
                    if($inc>0 && strcmp($data[$inc][0],$data[$inc-1][0])==0)
                    {
                        $strReturn.=    gui_td_tag("","","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
                        if($inc>0 && strcmp($data[$inc][1],$data[$inc-1][1])==0)
                        {
                            $strReturn.=    gui_td_tag("","","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
                            if($inc>0 && strcmp($data[$inc][2],$data[$inc-1][2])==0)
                            {   
			                    $strReturn.=    gui_td_tag("","","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
			                    $strReturn.=    gui_td_tag($data[$inc][3],"","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
			                    $strReturn.=    gui_td_tag($data[$inc][4],"","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
			                    $strReturn.=    gui_td_tag($data[$inc][5],"","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
			                }
			                else
			                {
			                    $strReturn.=    gui_td_tag($data[$inc][2],"","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
			                    $strReturn.=    gui_td_tag($data[$inc][3],"","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
			                    $strReturn.=    gui_td_tag($data[$inc][4],"","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
			                    $strReturn.=    gui_td_tag($data[$inc][5],"","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
			                }
                        }
                        else
                        {
                            $strReturn.=    gui_td_tag($data[$inc][1],"","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
                            $strReturn.=    gui_td_tag($data[$inc][2],"","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
		                    $strReturn.=    gui_td_tag($data[$inc][3],"","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
		                    $strReturn.=    gui_td_tag($data[$inc][4],"","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
		                    $strReturn.=    gui_td_tag($data[$inc][5],"","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
                        }
                    }
                    else
                    {
	                    $strReturn.=    gui_td_tag($data[$inc][0],"","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
	                    $strReturn.=    gui_td_tag($data[$inc][1],"","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
	                    $strReturn.=    gui_td_tag($data[$inc][2],"","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
	                    $strReturn.=    gui_td_tag($data[$inc][3],"","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
	                    $strReturn.=    gui_td_tag($data[$inc][4],"","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
	                    $strReturn.=    gui_td_tag($data[$inc][5],"","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
	                }
                    $strReturn.=    gui_tr_tag_close() ;
                }
				
			$strReturn.=    gui_table_tag_close() ; 
			
			return $strReturn;
			
		}
		catch (Exception $e)
		{
			throw new Exception($e->getMessage());
		}
	}
	//============================================================================
	// show_tab_hr_expert
	//============================================================================
	public function show_tab_hr_expert()
	{
		try
		{	
			GLOBAL  $LABEL_0068, $LABEL_0069,$LABEL_0187,$LABEL_0188,$LABEL_0189,$LABEL_0190,$LABEL_0191,$LABEL_0192,
					$REQUEST_018,$REQUEST_019;
			
			// A CODER optimiser le partage des données entre l'object user et les eai
			// On remet à jour la liste des noeuds
			$this->listNode = db_request_select($REQUEST_019,NULL,$this->db_name);
			// On remet à jour la liste des managers
			$this->listManager = db_request_select($REQUEST_018 , NULL,$this->db_name);
			
			echo 	gui_div_tag_open("tab_eai_hr_expert"); 
				echo 	gui_div_tag_open("accordion_eai_hr_expert"); 
					
					echo 	gui_div_tag_open(); 
						echo "<h3><a href=\"#\">".$LABEL_0069."</a></h3>";
						echo 	gui_div_tag_open(); 
						
							$this->show_hr_expert_data() ; 
						
						echo 	gui_div_tag_close();
					echo 	gui_div_tag_close();
					
					echo 	gui_div_tag_open(); 
						//========================================================
						// Tableau de bord des compétences
						echo "<h3><a href=\"#\">".$LABEL_0187."</a></h3>";
						echo 	gui_div_tag_open(); 
						
						/**********************/
						
						$this->show_dashboard_competence(PROFILE_EXPERT_RH);
						
						/**********************/
						
						echo 	gui_div_tag_close();
					echo 	gui_div_tag_close();
					
					echo 	gui_div_tag_open(); 
						//========================================================
						// Tableau de bord des évaluations globales
						echo "<h3><a href=\"#\">".$LABEL_0189."</a></h3>";
						echo 	gui_div_tag_open(); 
						
						/**********************/
						
						$this->show_dashboard_evaluation_trend(PROFILE_EXPERT_RH); 
						
						/**********************/
						
						echo 	gui_div_tag_close();
					echo 	gui_div_tag_close();
					
					echo 	gui_div_tag_open(); 
						//========================================================
						// Tableau de bord des formations
						echo "<h3><a href=\"#\">".$LABEL_0191."</a></h3>";
						echo 	gui_div_tag_open(); 
						
						/**********************/
						
						$this->show_dashboard_training(PROFILE_EXPERT_RH); 
						
						/**********************/
						
						echo 	gui_div_tag_close();
					echo 	gui_div_tag_close();
					
					echo 	gui_div_tag_open(); 
						//========================================================
						// Tableau de bord des objectifs de l'année écoulée
						echo "<h3><a href=\"#\">".$LABEL_0188."</a></h3>";
						echo 	gui_div_tag_open(); 
						
						/**********************/
						
						$this->show_dashboard_previous_objectives(PROFILE_EXPERT_RH); 
						
						/**********************/
						
						echo 	gui_div_tag_close();
					echo 	gui_div_tag_close();
					
					echo 	gui_div_tag_open(); 
						//========================================================
						// Tableau de bord des objectifs futurs
						echo "<h3><a href=\"#\">".$LABEL_0190."</a></h3>";
						echo 	gui_div_tag_open(); 
						
						/**********************/
						
						$this->show_dashboard_futur_objectives(PROFILE_EXPERT_RH); 
						
						/**********************/
						
						echo 	gui_div_tag_close();
					echo 	gui_div_tag_close();
					
					echo 	gui_div_tag_open(); 
						//========================================================
						// Tableau de bord bien-être et satisfaction
						echo "<h3><a href=\"#\">".$LABEL_0192."</a></h3>";
						echo 	gui_div_tag_open(); 
						
						/**********************/
						
						$this->show_dashboard_satisfaction(PROFILE_EXPERT_RH); 
						
						/**********************/
						
						echo 	gui_div_tag_close();
					echo 	gui_div_tag_close();
					
				echo 	gui_div_tag_close();		
			echo 	gui_div_tag_close();
		}
		catch (Exception $e)
		{
			throw new Exception($e->getMessage());
		}
	}
	//============================================================================
	// show_tab_admin
	//============================================================================
	public function show_tab_admin()
	{
		try
		{	
			GLOBAL  $LABEL_0121, $LABEL_0122,$LABEL_0124,$LABEL_0126,$LABEL_0142,$LABEL_0143,
					$REQUEST_139, $REQUEST_142,
					$ICON_UNLOCKED, $ICON_ADD,$ICON_UPDATE, 
					$DISPLAY_CREATION, $DISPLAY_UPDATE;
			
			echo 	gui_div_tag_open("tab_eai_admin"); 
				echo 	gui_div_tag_open("accordion_eai_admin"); 
					
					//===================================================================================================
					// Gestion des entretiens
					echo 	gui_div_tag_open(); 
						echo "<h3><a href=\"#\">".$LABEL_0121."</a></h3>";
						echo 	gui_div_tag_open(); 
							echo gui_jqueryui_ul_open();
							echo gui_form_post_open("eai_status_reset");		
								echo gui_table_tag_open();
									echo gui_tr_tag_open();
									//================================================
									//Selection d'un eai au statut cloturé ou validé par manager
									//================================================
									$data = db_request_select($REQUEST_139 , NULL , $this->db_name);
									$select_data = gui_form_select_field("select_id_eai_raz","select_id_eai_raz",$data,"",false,"",2,0) ; 
									
										echo gui_form_input_hidden_field("operation" ,"eai_status_reset");
											
										echo gui_td_tag($LABEL_0126.": ","","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
										echo gui_td_tag($select_data,"","left",NULL,NULL,NULL,NULL,NULL,NULL);
										// option RAZ en fonction de l'existance d'une campagne active en cours
										if(!$this->check_period_campaign())
										{
											$reset = gui_jqueryui_li_icon($ICON_UNLOCKED,"onclick=\"javascript: $('#dialog_info_campaign').dialog('open');\"");
										}
										else
										{
											$reset = gui_jqueryui_li_icon($ICON_UNLOCKED,"onclick=\"javascript: $('#dialog_raz_eai').dialog('open');\"");
										}
										echo gui_td_tag($reset,"","left",NULL,NULL,NULL,NULL,NULL,NULL);
											
									echo    gui_tr_tag_close();	
								echo    gui_table_tag_close();
							echo gui_form_post_close();	
							echo gui_jqueryui_ul_close();			
						echo 	gui_div_tag_close();
					echo 	gui_div_tag_close();
					
					//===================================================================================================
					// Gestion d'une campagne d'entretien
					echo 	gui_div_tag_open(); 
						echo "<h3><a href=\"#\">".$LABEL_0122."</a></h3>";
						echo 	gui_div_tag_open(); 
						
							// recherche de la dernière campagne
							$data   =	db_request_select($REQUEST_142,NULL,$this->db_name);
							
							echo	gui_jqueryui_ul_open();
							//Si aucune campagne n'est dans la base de données
							if($data == NULL || $data[0][0]==NULL)
							{
								$this->show_form_campaign(NULL, $DISPLAY_CREATION) ; 
								echo gui_jqueryui_li_icon($ICON_ADD,"onclick=\"javascript: $('#dialog_creation').dialog('open');\"");
							}
							else
							{
								echo gui_table_tag_open("100%",0,5,0,NULL,NULL,NULL);
									echo gui_tr_tag_open();
										echo gui_td_tag_open(NULL,NULL,NULL,3,NULL,NULL,NULL,NULL) ;
											$this->show_form_campaign($data[0], $DISPLAY_UPDATE); 
										echo gui_td_tag_close();
									echo gui_tr_tag_close();
									
									echo gui_tr_tag_open();
										echo gui_td_tag($LABEL_0142." ".$data[0][1]." ".$LABEL_0143." ".$data[0][2],"","left",NULL,NULL,NULL,"td_data_bold",NULL,NULL) ; 
										echo gui_td_tag_open("","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
											echo gui_jqueryui_li_icon($ICON_UPDATE,"onclick=\"javascript: $('#dialog_update').dialog('open');\"");
											
											// Si la date de fin de la campagne est antérieure à la date du jour alors on 
											// ajoute la possibilité de créer une nouvelle campgne
											$aujourdhui = new DateTime("now");
											$date_fin = DateTime::createFromFormat("d/m/Y",$data[0][2]);
										
											if($aujourdhui > $date_fin )
											{
												$this->show_form_campaign(NULL, $DISPLAY_CREATION) ; 
												echo gui_jqueryui_li_icon($ICON_ADD,"onclick=\"javascript: $('#dialog_creation').dialog('open');\"");
											}
										echo gui_td_tag(" ") ; 
									echo gui_tr_tag_close();
								echo gui_table_tag_close();
							}
							echo	gui_jqueryui_ul_close();
						echo 	gui_div_tag_close();
					echo 	gui_div_tag_close();
					
				echo 	gui_div_tag_close();		
			echo 	gui_div_tag_close();
		}
		catch (Exception $e)
		{
			throw new Exception($e->getMessage());
		}
	}
	//============================================================================
	// show_tab_sup_adm
	//============================================================================
	public function show_tab_sup_adm()
	{
		try
		{
			GLOBAL 	$LABEL_0099,$LABEL_0100,$LABEL_0124,
					$REQUEST_034,$REQUEST_109,$REQUEST_138,
					$ICON_DELETE;
			
			echo 	gui_div_tag_open("tab_eai_sup_adm"); 
				echo gui_form_post_open("modele_modification");
					echo gui_form_input_hidden_field("operation" ,"show_update_template");
					
					echo gui_table_tag_open("100%",0,3,0,NULL,NULL,NULL);
					
					//================================================
					//selection d'un client
					//================================================
					$data = db_request_select($REQUEST_034 , NULL , NULL);
					$select_data = gui_form_select_field("select_client_eai","select_client_eai",$data,"",false,"",0,100) ; 
					
					echo gui_tr_tag_open();
						echo gui_td_tag(Strings::LABEL_0016,"30%","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
						echo gui_td_tag($select_data,"70%","left",NULL,NULL,NULL,NULL,NULL,NULL);
					echo gui_tr_tag_close();
					
					//================================================
					//selection d'un modèle
					//================================================
					$data_2 = db_request_select($REQUEST_109 , NULL , $data[0][2]);
					$select_data_2 = gui_form_select_field("select_eai_template","select_eai_template",$data_2,"",false,"",0,0) ; 
					
					echo gui_tr_tag_open();
						echo gui_td_tag($LABEL_0100,"30%","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
						echo gui_td_tag($select_data_2,"70%","left",NULL,NULL,NULL,NULL,NULL,NULL);
					echo gui_tr_tag_close();
					
					echo gui_tr_tag_empty(1,2);
					
					echo gui_tr_tag_open();
						echo gui_td_tag_open("30%","left",NULL,2,NULL,NULL,NULL,NULL) ; 
							echo "\n<small><button type=\"submit\" onclick=\"javascript: load_img();\">".$LABEL_0099."</button></small>";
						echo gui_td_tag_close();
					echo gui_tr_tag_close();
						
					echo gui_table_tag_close();
				echo gui_form_post_close();
				// Option de suppresion d'un EAI
				echo gui_form_post_open("eai_delete");
					
					echo gui_form_input_hidden_field("operation" ,"eai_delete");
					echo gui_jqueryui_ul_open();
					echo gui_table_tag_open("",0,3,0,NULL,NULL,NULL);
					
						echo gui_tr_tag_open();
						
							echo gui_td_tag($LABEL_0124.": ","","left",NULL,NULL,NULL,NULL,NULL,NULL) ; 
							//===============================================
							//Selection d'un eai au statut cloturé
							//================================================
							echo gui_form_input_hidden_field("id_client_account" ,$this->id_compte_client);
							$tab_arg_1		= array(	':id_status'	=> self::EAI_STATUS_VALID_USER_FINAL);
							$tab_arg_2		= array(	':id_status'	=> self::EAI_STATUS_NO_VALID_MANAGER);
							$tab_arg_3		= array(	':id_status'	=> self::EAI_STATUS_NO_VALID_USER);
							$data_1  = db_request_select($REQUEST_138 , $tab_arg_1 , $this->db_name);
							$data_2  = db_request_select($REQUEST_138 , $tab_arg_2 , $this->db_name);
							$data_3  = db_request_select($REQUEST_138 , $tab_arg_3 , $this->db_name);
							
							$data = array_merge($data_1, $data_2, $data_3);
							
							$select_data = gui_form_select_field("select_id_eai","select_id_eai",$data,"",false,"",3,0) ; 
							echo gui_td_tag($select_data,"","left",NULL,NULL,NULL,NULL,NULL,NULL);
							$delete = gui_jqueryui_li_icon($ICON_DELETE,"onclick=\"javascript: $('#dialog_del_eai').dialog('open');\"");
							echo gui_td_tag($delete,"","left",NULL,NULL,NULL,NULL,NULL,NULL);
							
						echo    gui_tr_tag_close();
					echo gui_table_tag_close();	
				echo gui_form_post_close();
				
			echo 	gui_div_tag_close();
		}
		catch (Exception $e)
		{
			throw new Exception($e->getMessage());
		}
	}
	
}	
?>
